Guest User

Untitled

a guest
Aug 31st, 2018
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import smtplib
  2.  
  3. # Import the email modules we'll need
  4. from email.mime.text import MIMEText
  5. from typing import TextIO
  6.  
  7. smtp_ssl_host = 'smtp.gmail.com'
  8.  
  9. #SMTP over SSL - Conflito registrado com protocolo Cisco
  10. smtp_ssl_port = 465
  11. #conta
  12. username = 'raelmotta229@gmail.com'
  13. password = 'fuchsfox'
  14. #remetente
  15. sender = 'raelmotta229@hotmail.com'
  16.  
  17. targets = ['raelmotta229@gmail.com', 'raelmotta229@hotmail.com']
  18.  
  19. #criar um arquivo e enviar
  20. text = open("C:\Users\raelm\PycharmProjects\aula-teste\msg1.txt", 'r')
  21. msg = MIMEText(text)
  22.  
  23. msg['Subject'] = 'Hello'
  24. msg['From'] = sender
  25. msg['To'] = ', '.join(targets)
  26.  
  27. server = smtplib.SMTP_SSL(smtp_ssl_host, smtp_ssl_port)
  28. server.login(username, password)
  29. server.sendmail(sender, targets, msg.as_string())
  30. server.quit()
Add Comment
Please, Sign In to add comment