I have a very simple piece of code (just for testing):
server = 'smtp.myprovider.com'
recipients = ['firstname.lastname@example.org']
sender = 'email@example.com'
message = 'Subject: [PGS]: Results\n\nBlaBlaBla'
session = smtplib.SMTP(server)
smtplib doesn't automatically include a
From: header, so you have to put one in yourself:
message = 'From: firstname.lastname@example.org\nSubject: [PGS]: Results\n\nBlaBlaBla'
smtplib doesn't include any headers automatically, but just sends the text that you give it as a raw message)