Email multiple contacts in Python

python

Solution

Try

s.sendmail(me, you.split(","), msg.as_string())

If you do `you = ['a@a.com', 'a@a.com']`

Try

msg['To'] = ",".join(you)

...

s.sendmail(me, you, msg.as_string())

Problem

I am trying to send an email to multiple addresses. The code below shows what I'm attempting to achieve. When I add two addresses the email does not send to the second address. The code is: ``` me = 'a@a.com' you = 'a@a.com, a@a.com' msg['Subject'] = "Some Subject" msg['From'] = me msg['To'] = you # Send the message via our own SMTP server s = smtplib.SMTP('a.a.a.a') s.sendmail(me, [you], msg.as_string()) s.quit() ``` I have tried: ``` you = ['a@a.com', 'a@a.com'] ``` and ``` you = 'a@a.com', 'a@a.com' ``` Thanks

Original source