server.login(from_email, password)
.# modules
import smtplib
from email.message import EmailMessage
# content
sender = "***@gmail.com"
reciever = "***@gmail.com"
password = "16-char password from google-security"
msg_body = '''You are baby
venue: pythonguides
lounge
time: 6 pm
date: 18 october 2020
blossom the party with your presence.
'''
# action
msg = EmailMessage()
msg['subject'] = 'Invitation to birthday party!'
msg['from'] = sender
msg['to'] = reciever
msg.set_content(msg_body)
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as smtp:
smtp.login(sender,password)
smtp.send_message(msg)