In this section, we're going to learn about the email message format. Email messages consist of three primary components:
- The receiver's email address
- The sender's email address
- The message
There are other components also included in the message format, such as the subject line, email signatures, and attachments.
Now, we're going to see a simple example of sending a plain text email from your Gmail address, in which you'll learn about writing an email message and sending it. Now, create a script, write_email_message.py, and write the following content in it:
import smtplib
import getpass
host_name = "smtp.gmail.com"
port = 465
sender = 'sender_emil_id'
receiver = 'receiver_email_id'
password = getpass.getpass()
msg = """\
Subject: Test Mail
Hello from Sender !!"""
s = smtplib.SMTP_SSL...