import smtplib
#The mail addresses and password
sender_address = '[email protected]'
sender_pass = 'abc123'
receiver_address = '[email protected]'
#Create SMTP session for sending the mail
session = smtplib.SMTP('smtp.gmail.com', 587) #use gmail with port
session.starttls() #enable security
session.login(sender_address, sender_pass) #login with mail_id and password
session.sendmail(sender_address, receiver_address, "Hello world!")
session.quit()
print('Mail Sent')
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
import smtplib
#The mail addresses and password
sender_address = '[email protected]'
sender_pass = 'abc123'
receiver_address = '[email protected]'
#Create SMTP session for sending the mail
session = smtplib.SMTP('smtp.gmail.com', 587) #use gmail with port
session.starttls() #enable security
session.login(sender_address, sender_pass) #login with mail_id and password
session.sendmail(sender_address, receiver_address, "Hello world!")
session.quit()
print('Mail Sent')