Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import smtplib
- import email
- msg = email.message.Message()
- msg["From"] = "user@gmail.com"
- msg["To"] = "user@gmail.com"
- msg["Subject"] = "Test message"
- server = smtplib.SMTP("smtp.gmail.com",587)
- server.starttls()
- server.ehlo_or_helo_if_needed()
- try:
- failed = server.sendmail("user@gmail.com","user@gmail.com", msg.as_string())
- server.close()
- except Exception as e:
- print(e)
- (530, b'5.5.1 Authentication Required. Learn more at
- 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 fw5sm21125889wib.0', 'user@gmail.com')
- 10 alt1.gmail-smtp-in.l.google.com.
- 40 alt4.gmail-smtp-in.l.google.com.
- 5 gmail-smtp-in.l.google.com.
- 30 alt3.gmail-smtp-in.l.google.com.
- 20 alt2.gmail-smtp-in.l.google.com.
Add Comment
Please, Sign In to add comment