# coding: UTF-8
import smtplib
from email.mime.text import MIMEText
from email.header import Header
from email import charset
from email.Utils import formatdate
#Header addition
def create_message(from_addr,to_addr,subject,body):
message = MIMEText(body)
message['Subject'] = subject
message['From'] = from_addr
message['To'] = to_addr
message['Date'] = formatdate()
return message
#send e-mail
def send(from_addr,to_addr, msg):
s = smtplib.SMTP('localhost:25') s.sendmail(from_addr, [to_addr], msg.as_string())
s.close()
Recommended Posts