I am using the following code to send a file to 3 recipients including me.
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
SUBJECT = "Successful !"
msg = MIMEMultipart()
msg['Subject'] = SUBJECT
msg['From'] = <myemail>
emails=["<myemail>","<email2>","<email3>"]
msg['To'] = ', '.join(emails)
part = MIMEBase('application', "octet-stream")
part.set_payload(open("test.txt", "rb").read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="success.txt"')
msg.attach(part)
server = smtplib.SMTP("<server_address>")
server.sendmail(msg['From'],msg['To'], msg.as_string())
In this case, I receive the email but not the other two recipients.
I also tried using
server.sendmail(msg['From'],emails, msg.as_string())
in place of the last line. Again, I receive the email, but not the other two recipient.