Created
December 16, 2022 14:24
-
-
Save paitonic/23a462c7f8b609378023a50ea1af589d to your computer and use it in GitHub Desktop.
local smtp server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python3 -m pip install aiosmtpd | |
python3 -m aiosmtpd -ddd -n | |
# send.py | |
import smtplib | |
from email.message import EmailMessage | |
smtp = smtplib.SMTP(host='localhost', port=8025) | |
msg = EmailMessage() | |
msg.set_content('Hello body') | |
msg['Subject'] = 'sub' | |
msg['From'] = 'from@email.com' | |
msg['To'] = 'to@email.com' | |
v = smtp.send_message(msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment