mail.py
from email.mime.text import MIMEText
import smtplib
#Informations d'identification SMTP
account = "example.com"
password = "XXXXXXXX"
#Destination d'envoi / réception
to_email = "[email protected]"
from_email = "[email protected]"
#Créer un MIME
subject = "Titre du test"
message = "Corps de test"
msg = MIMEText(message, "html")
msg["Subject"] = subject
msg["To"] = to_email
msg["From"] = from_email
#Processus d'envoi d'e-mails
server = smtplib.SMTP("example.com", 587)
server.starttls()
server.login(account, password)
server.send_message(msg)
server.quit()
python mail.py
Recommended Posts