A quick way to send email with Python.
import smtplib
msg_from = "me@email.com"
msg_to = "you@email.com"
smtp_server = "mail.mailserver.com"
msg_subject = "Hello"
msg_body = "This is message body."
msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n%s" % (msg_from, msg_to, msg_subject, msg_body))
server = smtplib.SMTP(smtp_server)
server.set_debuglevel(1)
server.sendmail(msg_from, msg_to, msg)
server.quit()
No comments:
Post a Comment