Sending mail from Python using SMTP - Stack Overflow
stackoverflow.com › questions › 64505Sep 15, 2008 · The method I commonly use...not much different but a little bit. import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText msg = MIMEMultipart() msg['From'] = 'me@gmail.com' msg['To'] = 'you@gmail.com' msg['Subject'] = 'simple email in python' message = 'here is the email' msg.attach(MIMEText(message)) mailserver = smtplib.SMTP('smtp.gmail.com',587 ...