More actions
It possible to use the module smtplib
to send an Email with python3.
#!/usr/bin/env python3 import smtplib from email.message import EmailMessage to_addr = 'to@example.com' from_addr = 'from@example.com' mail_server = 'mail.example.com' passwd = 'YOUR_MAILBOX_PASSWORD' message = EmailMessage() message["To"] = to_addr message["From"] = from_addr message["Subject"] = 'Sent with Python & Smtplib' message.set_payload('This is a test message!') s = smtplib.SMTP_SSL(mail_server, 465) s.login(to_addr, passwd) s.sendmail(to_addr, from_addr, message.as_string()) s.quit()