The documentation of this mini-project contain have the following parts:
- The modules imported from Python
- SMTP connection secured by SSL (Secure Sockets Layer)
- Attachment of a plain-text and a PDF file to send
- Disclaimer
- References
smtplib
ssl
email
To send a mail using the Simple Mail Transfer Protocol we need to use the Python module called smtplib
. After that we creates a SSL connection with the SMTP Gmail Server importing the ssl
module and using SMTP_SSL()
.
This project uses MIME messages, which allow us to send plait-text versions of a email and also HTML versions.
If you are using SMTP Google Server, from your sender mail you need to enable the Two Auth Factor and create an app password because you can experiment the following error:
smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted)
For more information and details you can check the following tutorial: Solution to SMTPAuth Gmail