Mail.py 374 Bytes
Newer Older
jtchilders's avatar
jtchilders committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import sys,subprocess,logging
logger = logging.getLogger(__name__)

MAIL = 'mail'

def send_mail(sender,receiver,subject,body):
   
   p = subprocess.Popen([MAIL,'-s',str(subject),receiver],stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE)
   stdout,stdin = p.communicate(input=str(body))


#send_mail('','jchilders@anl.gov','test subject','test body')