[Python] Mail senden
Erstellen Sie ein E-Mail-Sendeskript
mail.py
from email.mime.text import MIMEText
import smtplib
#SMTP-Anmeldeinformationen
account = "example.com"
password = "XXXXXXXX"
#Ziel senden / empfangen
to_email = "[email protected]"
from_email = "[email protected]"
#MIME erstellen
subject = "Testtitel"
message = "Testkörper"
msg = MIMEText(message, "html")
msg["Subject"] = subject
msg["To"] = to_email
msg["From"] = from_email
#E-Mail-Sendevorgang
server = smtplib.SMTP("example.com", 587)
server.starttls()
server.login(account, password)
server.send_message(msg)
server.quit()
Lauf
python mail.py