SHARE
TWEET

Untitled

a guest Aug 19th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import threading
  2. import smtpd
  3. import asyncore
  4. import smtplib
  5.  
  6. server = smtpd.SMTPServer(('localhost', 1025), None)
  7.  
  8. loop_thread = threading.Thread(target=asyncore.loop, name="Asyncore Loop")
  9. # If you want to make the thread a daemon
  10. # loop_thread.daemon = True
  11. loop_thread.start()
  12.  
  13. # port should match your SMTP server
  14. client = smtplib.SMTP('localhost', port=1025)
  15.  
  16. fromaddr = 'your_email@gmail.com'
  17. toaddrs = 'your_friend@gmail.com'
  18. msg = 'Hello'
  19.  
  20. server.sendmail(fromaddr, toaddrs, msg)
  21. server.quit()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top