Sending emails to 3 addresses....

Boudreau, Emile Emile.Boudreau at cognos.com
Fri Mar 30 08:54:08 EDT 2007


Hello all, I'm trying to send a results email to 3 people. For some
reason only the first person in the list will receive the email but in
the received email it shows the 3 addresses. Here is my code, can
someone show me where I'm going wrong?? Thanks

sendMail('this is the subject line', 'the results: 71 fails, 229 pass,
300 total.', 'user1 at mycompany.com, user2 at mycompany.com,
user3 at mycompany.com')

def sendMail(subject, body, TO, FROM="machine at mycompany.com"):
    print TO
    HOST = "exchange.mycompany.com"
    BODY = string.join((
        "From: %s" % FROM,
        "To: %s" % TO,
        "Subject: %s" % subject,
        "",
        body
        ), "\r\n")
    server = smtplib.SMTP(HOST)
    server.sendmail(FROM, [TO], BODY)
    server.quit()

Emile Boudreau
 
     This message may contain privileged and/or confidential information.  If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070330/cf203350/attachment.html>


More information about the Python-list mailing list