Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement