Specify a sender when sending mail with Python (smtplib)

smtplib doesn’t automatically include a From: header, so you have to put one in yourself:

message="From: [email protected]\nSubject: [PGS]: Results\n\nBlaBlaBla"

(In fact, smtplib doesn’t include any headers automatically, but just sends the text that you give it as a raw message)

Leave a Comment