Python - Send Email With smtplib
Python - Send Email With smtplib
Submitted by corey@goldb.org (Corey Goldberg) on Wed, 16/12/2009 - 18:14.This is mostly just for my own reference
sending an email using Python's smtplib:
import smtplib from email.MIMEText import MIMEText smtp_server = 'exchangeserver.foo.com' recipients = ['corey@foo.com',] sender = 'corey@foo.com' subject = 'subject goes here' msg_text = 'message body goes here' msg = MIMEText(msg_text) msg['Subject'] = subject s = smtplib.SMTP() s.connect(smtp_server) s.sendmail(sender, recipients, msg.as_string()) s.close()
