Advertisement
paulogp

Enviar email

Aug 22nd, 2011
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. # send mail
  2. import smtplib
  3.  
  4. fromaddr = 'test@server.com'
  5. toaddrs = 'test2@server.com'
  6.  
  7. msg = 'Hello World'
  8.  
  9. # provide user name and password
  10. username = 'login'
  11. password = 'password'
  12.  
  13. # send an email with authentication
  14. server = smtplib.SMTP('smtp.server.com', 587)
  15. server.ehlo()
  16. server.starttls()
  17. server.ehlo()
  18. server.login(username, password)
  19. server.sendmail(fromaddr, toaddrs, msg)
  20. server.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement