python

Python 3 Script to Send Email to Multiple Recipients Using smtplib Full Project For Beginners


 

 

This really works, I spent a lot of time trying multiple variants.

 

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(sender, recipients, msg.as_string())

Similar Posts:

    None Found

Leave a Reply

Your email address will not be published. Required fields are marked *