How to send email using Python
Sending mail is done with Python's smtplib using an Simple Mail Transfer Protocol (SMTP) server. Python's smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon.
Email and MIME objects
Multipurpose Internet Mail Extensions (MIME) is an Internet standard that expand upon the limited capabilities of email, and in particular to allow documents (such as images, sound, and text) to be inserted in a message.
SMTPAuthenticationError when sending mail using gmail
Sometimes when you send email using gmail address you can see some error message like this:
It is because Google blocks sign-in attempts from apps which do not use modern security standards (mentioned on their support page). You can however, turn on/off this safety feature by going to the link below:
Go to this link and select Turn Onhttps://www.google.com/settings/security/lesssecureapps
Moreover google block an ip when you try to send a email since a unusual location, so, you can unblock in the next linkhttps://support.google.com/accounts/answer/6009563
and clicked in
Gmail SMTP Settings
If you use Gmail with your work or school account, check with your administrator for the correct SMTP configuration.
- How to find hostname of a computer - Python
- How To Find IP Address In Python
- Retrieving Email from a POP3 Server - Python
- Retrieving Web Pages with HTTP using Python
- How to open a web browser using Python
- Creating an FTP client in Python
- Socket Programming in Python
- Multi threaded socket programming in Python