Skip to content

Instantly share code, notes, and snippets.

@zhovner
Created June 23, 2013 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhovner/5845609 to your computer and use it in GitHub Desktop.
Save zhovner/5845609 to your computer and use it in GitHub Desktop.
# Simple python mailer
# How to use: mailer('subject', 'mail@address', bodyvar)
from subprocess import *
def mailer(MailerSubject, RecipientAddress, MailBody):
readBody = Popen(["/bin/echo", MailBody], stdout=PIPE)
mail = Popen(["/usr/bin/mail", "-s", MailerSubject, RecipientAddress], stdin=readBody.stdout, stdout=PIPE)
output = mail.communicate()[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment