Skip to content

Instantly share code, notes, and snippets.

@paitonic
Created December 16, 2022 14:24
Show Gist options
  • Save paitonic/23a462c7f8b609378023a50ea1af589d to your computer and use it in GitHub Desktop.
Save paitonic/23a462c7f8b609378023a50ea1af589d to your computer and use it in GitHub Desktop.
local smtp server
# 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