Hey Guys, I'm having a problem with my script that sends out an email using
smtplib. Whats happening now is when it is send I get a (no subject) where
the subject line should be. I checked a few places such as effbot and some
other online doc but couldn't find any thing about the subject line.

Any help would be much appreciated.

###################################
#Created by: Daniel McQuay
#This script will send and email
#to verify if the backup was
#successful or not.
###################################

import smtplib
import sys

emmssg = "/tmp/backup.log"
smtpserver = 'localhost'
AUTHREQUIRED = 0
smtpuser = ''
smtppass = ''

#Recipients who will be getting the emails
RECIPIENTS = ['[EMAIL PROTECTED]']

SENDER = 'Saint_Richards'

#This does not work?
SUBJECT = 'Backup_Log'

emmssg = open('/tmp/backup.log','r').read()

session = smtplib.SMTP(smtpserver)
if AUTHREQUIRED:
   session.login(smtpuser, smtppass)
smtpresult = session.sendmail(SENDER, RECIPIENTS, SUBJECT, emmssg)

if smtpresult:
   errstr = ""
   for recip in smtpresult.keys():
       errstr = """Could not delivery mail to: %s

Server said: %s
%s

%s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
   raise smtplib.SMTPException, errstr

Thanks in advance,

--
Daniel McQuay
Jaluno.com
H: 814.825.0847
M: 814-341-9013
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to