Thanks Mike, it seems that I'll be easy to incorporate that into my script as well. <br><br>I'll give it a try. I'm still open to other suggestions, though.<br><br><div><span class="gmail_quote">On 5/23/07, <b class="gmail_sendername">
Mike Hansen</b> <<a href="mailto:Mike.Hansen@atmel.com">Mike.Hansen@atmel.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><br>> -----Original Message-----<br>> From: <a href="mailto:tutor-bounces@python.org">tutor-bounces@python.org</a><br>> [mailto:<a href="mailto:tutor-bounces@python.org">tutor-bounces@python.org</a>] On Behalf Of Daniel McQuay
<br>> Sent: Wednesday, May 23, 2007 1:49 PM<br>> To: <a href="mailto:tutor@python.org">tutor@python.org</a><br>> Subject: [Tutor] smtplib howto send with a subject line<br>><br>> Hey Guys, I'm having a problem with my script that sends out
<br>> an email using smtplib. Whats happening now is when it is<br>> send I get a (no subject) where the subject line should be. I<br>> checked a few places such as effbot and some other online doc<br>> but couldn't find any thing about the subject line.
<br>><br>> Any help would be much appreciated.<br>><br>> ###################################<br>> #Created by: Daniel McQuay<br>> #This script will send and email<br>> #to verify if the backup was<br>
> #successful or not.<br>> ###################################<br>><br>> import smtplib<br>> import sys<br>><br>> emmssg = "/tmp/backup.log"<br>> smtpserver = 'localhost'<br>> AUTHREQUIRED = 0
<br>> smtpuser = ''<br>> smtppass = ''<br>><br>> #Recipients who will be getting the emails<br>> RECIPIENTS = ['<a href="mailto:simplebob@gmail.com">simplebob@gmail.com</a>']<br>>
<br>> SENDER = 'Saint_Richards'<br>><br>> #This does not work?<br>> SUBJECT = 'Backup_Log'<br>><br>> emmssg = open('/tmp/backup.log','r').read()<br>><br>> session =
smtplib.SMTP(smtpserver)<br>> if AUTHREQUIRED:<br>> session.login(smtpuser, smtppass)<br>> smtpresult = session.sendmail(SENDER, RECIPIENTS, SUBJECT, emmssg)<br>><br>> if smtpresult:<br>> errstr = ""
<br>> for recip in smtpresult.keys():<br>> errstr = """Could not delivery mail to: %s<br>><br>> Server said: %s<br>> %s<br>><br>> %s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
<br>> raise smtplib.SMTPException, errstr<br>><br>> Thanks in advance,<br>><br>> --<br>> Daniel McQuay<br>> <a href="http://Jaluno.com">Jaluno.com</a><br>> H: 814.825.0847<br>> M: 814-341-9013
<br>><br><br>It seems a little easier to use the email module along with the smtp<br>module to create and send a message.<br><br><a href="http://docs.python.org/lib/node162.html">http://docs.python.org/lib/node162.html
</a><br><br>Mike<br>_______________________________________________<br>Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor
</a><br></blockquote></div><br><br clear="all"><br>-- <br>Daniel McQuay<br>Linux Jedi<br><a href="http://Jaluno.com">Jaluno.com</a><br>H: 814.825.0847<br>M: 814-341-9013