smtp module - specifying multiple email recipients?

Paul Wright -$P-W$- at noctua.org.uk
Thu Jul 1 09:32:25 EDT 2004


In article <10e81rhimo0ohd5 at corp.supernews.com>, Alex Hunsley wrote:
> I'm using the smtp module to send emails from python.
 
>         me = 'my at sending.address'
>         you = 'recipient1 at some.where,recipient2 at some.where'

>         s.sendmail(me, [you], msg.as_string())
> 
> .. when I execute this code, only recipient1 at some.where gets the email. 
> Is there a way to specifiy multiple addresses in the To field?

The second argument to sendmail is a list, not a comma separated string.
Currently, you've specified a single address containing a comma. Your
MTA has charitably decided to deliver it to the first address, although
I expect other MTAs would just reject it. If you've got comma separated
addresses in a string, make a list using s.split(",").

-- 
Paul Wright | http://pobox.com/~pw201 | http://blog.noctua.org.uk/
Reply address is valid but discards mail with attachments: send plain text only



More information about the Python-list mailing list