I needed to send an email, so I came up with this:
def send_plain_mail(subject, body, from_mail, to): import smtplib from email.MIMEText import MIMEText from email.Encoders import encode_quopri msg = MIMEText(body, 'plain', 'iso-8859-1') msg['Subject'] = subject msg['From'] = from_mail msg['To'] = to s = smtplib.SMTP() s.connect() s.sendmail(from_mail, [to], msg.as_string()) s.close()
Not rocket science, but it gets the job done.