Skip to content

Instantly share code, notes, and snippets.

@zhovner zhovner/mailer.py

Created Jun 23, 2013
Embed
What would you like to do?
# 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
You can’t perform that action at this time.