E-mail is prone to disclosure of information. Most e-mails are currently transmitted in clear text format. E-mail encryption involves encrypting or disguising content of the e-mail so that the content is read by the intended recipients. Always remember that security is of prime importance when dealing with e-mails. Let's see how we can encrypt e-mails with Python.
We looked at sending a basic e-mail in the previous recipe, but what's the
starttls() method? How does e-mail encryption work? We will get answers to these questions in this section.
import smtplib server = smtplib.SMTP('smtp.gmail.com', 587) try: server.set_debuglevel(True) ...