import smtplib, ssl

port = 587  # For starttls
smtp_server = "smtp.gmail.com"
sender_email = <EMAIL>"
receiver_email = <EMAIL>"
password = input("Type your password and press enter:")
message = """\
Subject: Hi there

This message is another msg sent from Python."""

context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
    server.ehlo()  # Can be omitted
    server.starttls(context=context)
    server.ehlo()  # Can be omitted
    server.login(sender_email, password)
    server.sendmail(sender_email, receiver_email, message)
import smtplib, ssl

port = 587  # For starttls
smtp_server = "smtp.gmail.com"
sender_email = <EMAIL>"
receiver_email = <EMAIL>"
password = input("Type your password and press enter:")
message = """\
Subject: Hi there

This message is another msg sent from Python."""

context = ssl.create_default_context()
with smtplib.SMTP(smtp_server, port) as server:
    server.ehlo()  # Can be omitted
    server.starttls(context=context)
    server.ehlo()  # Can be omitted
    server.login(sender_email, password)
    server.sendmail(sender_email, receiver_email, message)
# For starttls \ Subject: Hi there  This message is another msg sent from Python. # Can be omitted # Can be omitted