I was wondering. Is there any way to add multiple receivers in Python on its default SMTPlib?
Like (subject and content set already, smtp server gmail.):
python sendmail.py receiver1@gmail.com receiver2@gmail.com receiver3@gmail.com ...
Thanks
Tested before posting!
import smtplib
from email.mime.text import MIMEText
s = smtplib.SMTP('smtp.uk.xensource.com')
s.set_debuglevel(1)
msg = MIMEText("""body""")
sender = 'me@example.com'
recipients = ['john.doe@example.com', 'john.smith@example.co.uk']
msg['Subject'] = "subject line"
msg['From'] = sender
msg['To'] = ", ".join(recipients)
s.sendmail(msg.get('From'), recipients, msg.as_string())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With