Multi Recipients With smtplib?

John Abel john.abel at pa.press.net
Mon Nov 25 08:42:09 EST 2002


Hi,

I am trying to send a mail, to multiple recipients, without much 
success.  A single mail address works fine, but when I add another, 
using a comma to separate the addresses, the second address fails to 
receive the mail.  Any ideas?  Here's the code I am using:

        mailMessage = "From: %s \r\nTo: %s\r\n" % (self.mailFrom, 
self.mailTo)
        mailMessage += "Subject: %s\r\n%s" % (mailSubject, mailBody)
        try:
            self.MailConn.sendmail( self.mailFrom, self.mailTo, mailMessage)
        except (smtplib.SMTPRecipientsRefused, 
smtplib.SMTPSenderRefused), ErrorMsg:
            print "There Was A Problem Sending The Mail.  Reason: %s" % 
ErrorMsg

Any help would be appreciated, as this is driving me mad!

Thanks

John







More information about the Python-list mailing list