Emailing in Python
Fredrik Lundh
fredrik at pythonware.com
Tue Dec 14 11:12:53 EST 2004
Philippe Reynolds wrote:
> I'm learning python...one of my tasks is to send out emails...
> I can send emails to one person at a time but not as groups....
>
> Do you think you can help.
>
> Cheers
> Philippe Reynolds
>
> Here is the section of code:
> # me == the sender's email address
> me = 'phil_ren at hotmail.com'
> # you == the recipient's email address
>
> email_list= 'preyn085 at uottawa.ca, phil_ren at hotmail.com'
that's a string, not a list. how about:
email_list= ["preyn085 at uottawa.ca", "phil_ren at hotmail.com"]
> msg['Subject'] = 'EVENT REPORT'
> msg['From'] = me
> msg['To'] = email_list
>
> # Send the message via our own SMTP server, but don't include the
> # envelope header.
> s = smtplib.SMTP()
> s.connect()
> s.sendmail(me, [email_list], msg.as_string())
and
s.sendmail(me, email_list, msg.as_string())
> s.close()
?
</F>
More information about the Python-list
mailing list