Advertisement
Viktor_BR

Untitled

Jun 6th, 2018
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. import smtplib, getpass
  2. from email.mime.multipart import MIMEMultipart
  3. from email.mime.text import MIMEText
  4.  
  5. print("**** Enviar E-mail ****")
  6. user = input("Conta Outlook: ")
  7. password = input("Senha: ")
  8.  
  9. De = input("De: ")
  10. Para = input("Para: ")
  11. Assunto = input("Assunto: ")
  12. Mensagem = input("Mensagem: ")
  13.  
  14. #Host e porta SMTP de Outlook
  15. outlook = smtplib.SMTP('smtp.office365.com', 587)
  16.  
  17. outlook.starttls()
  18.  
  19. outlook.login(user, password)
  20.  
  21. outlook.set_debuglevel(1)
  22.  
  23. header = MIMEMultipart()
  24. header['Assunto'] = Assunto
  25. header['De'] = De
  26. header['Para'] = Para
  27.  
  28. Mensagem = MIMEText(Mensagem, 'html') #Content-type:text/html
  29. header.attach(Mensagem)
  30.  
  31. #Enviar email
  32. outlook.sendmail(De, Para, header.as_string())
  33.  
  34. outlook.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement