send email to multiple recipients

PHOTO EMBED

Thu Mar 30 2023 11:31:46 GMT+0000 (Coordinated Universal Time)

Saved by @quaie #python

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())
content_copyCOPY

https://stackoverflow.com/questions/8856117/how-to-send-email-to-multiple-recipients-using-python-smtplib