Posted By

galaxstar on 01/07/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

magna


sendmail


 / Published in: Python
 

  1. def sendMail():
  2. sendmail_location = "/usr/sbin/sendmail" # sendmail location
  3. p = os.popen("%s -t" % sendmail_location, "w")
  4. p.write("From: %s\n" % "[email protected]")
  5. p.write("To: %s\n" % "[email protected]")
  6. p.write("Subject: thesubject\n")
  7. p.write("\n") # blank line separating headers from body
  8. p.write("body of the mail")
  9. status = p.close()
  10. if status != 0:
  11. print "Sendmail exit status", status

Report this snippet  

You need to login to post a comment.