#!/usr/bin/python
import smtplib
SERVER = "mail.example.com"
FROM = "noreply@example.com"
TO = ["User@example.com"]
SUBJECT = "Hello! I am Python"
TEXT = "This message was sent with Python's smtplib."
# Prepare actual message
message = """\
From: %s
To: %s
Subject: %s
%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
# Send the mail
server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()
# You can buy me a beer.
import smtplib
SERVER = "mail.example.com"
FROM = "noreply@example.com"
TO = ["User@example.com"]
SUBJECT = "Hello! I am Python"
TEXT = "This message was sent with Python's smtplib."
# Prepare actual message
message = """\
From: %s
To: %s
Subject: %s
%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
# Send the mail
server = smtplib.SMTP(SERVER)
server.sendmail(FROM, TO, message)
server.quit()
# You can buy me a beer.
Thanks!!!
ReplyDelete