How to send an email with Python?

This code works and sends me an email just fine: import smtplib #SERVER = “localhost” FROM = ‘[email protected]’ TO = [“[email protected]”] # must be a list SUBJECT = “Hello!” TEXT = “This message was sent with Python’s smtplib.” # Prepare actual message message = “””\ From: %s To: %s Subject: %s %s “”” % (FROM, … Read more

How to send email to multiple recipients using python smtplib?

After much searching I couldn’t find out how to use smtplib.sendmail to send to multiple recipients. The problem was every time the mail would be sent the mail headers would appear to contain multiple addresses, but in fact only the first recipient would receive the email. The problem seems to be that the email.Message module … Read more