a guest Aug 19th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import threading
- import smtpd
- import asyncore
- import smtplib
- server = smtpd.SMTPServer(('localhost', 1025), None)
- loop_thread = threading.Thread(target=asyncore.loop, name="Asyncore Loop")
- # If you want to make the thread a daemon
- # loop_thread.daemon = True
- # port should match your SMTP server
- client = smtplib.SMTP('localhost', port=1025)
- fromaddr = 'email@example.com'
- toaddrs = 'firstname.lastname@example.org'
- msg = 'Hello'
- server.sendmail(fromaddr, toaddrs, msg)
RAW Paste Data