Guest User

Untitled

a guest
Dec 4th, 2018
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import smtplib
  2. import email
  3. msg = email.message.Message()
  4. msg["From"] = "user@gmail.com"
  5. msg["To"] = "user@gmail.com"
  6. msg["Subject"] = "Test message"
  7. server = smtplib.SMTP("smtp.gmail.com",587)
  8. server.starttls()
  9. server.ehlo_or_helo_if_needed()
  10. try:
  11. failed = server.sendmail("user@gmail.com","user@gmail.com", msg.as_string())
  12. server.close()
  13. except Exception as e:
  14. print(e)
  15.  
  16. (530, b'5.5.1 Authentication Required. Learn more at
  17. 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 fw5sm21125889wib.0', 'user@gmail.com')
  18.  
  19. 10 alt1.gmail-smtp-in.l.google.com.
  20. 40 alt4.gmail-smtp-in.l.google.com.
  21. 5 gmail-smtp-in.l.google.com.
  22. 30 alt3.gmail-smtp-in.l.google.com.
  23. 20 alt2.gmail-smtp-in.l.google.com.
Add Comment
Please, Sign In to add comment