mail.py
from email.mime.text import MIMEText
import smtplib
#SMTP authentication information
account = "example.com"
password = "XXXXXXXX"
#Send / receive destination
to_email = "[email protected]"
from_email = "[email protected]"
#Create MIME
subject = "Test title"
message = "Test body"
msg = MIMEText(message, "html")
msg["Subject"] = subject
msg["To"] = to_email
msg["From"] = from_email
#Email sending process
server = smtplib.SMTP("example.com", 587)
server.starttls()
server.login(account, password)
server.send_message(msg)
server.quit()
python mail.py
Recommended Posts