Hi,
i have a python script running on an apache server. what i want is to be able to call sendmail from the python script from the webbrowser.
here is my code.
def sendMail(name, email) :
MAIL = "/usr/sbin/sendmail"
ADDRESS = '%s'%(email)
# get the email message from a file
mssg = "Hello %s, \n This is a test email"%(username)
# open a pipe to the mail program and
# write the data to the pipe
p = os.popen("%s %s" %(MAIL,ADDRESS), 'w')
p.write(mssg)
exitcode = p.close()
if exitcode:
print "Exit code: %s" % exitcode
this works in a python shell but not from the webbrowser. i suspect the path to sendmail is the problem.
how do i get sendmail to work from apache, do i have to add it to some sort of path variable? does apache have its own sendmail functions i can use? or python it self have a better alternative.
im new to all of this so please be gentle
ta