Send Emails using Python

Code

import smtplib, ssl

port = 465  # For SSL
smtp_server = "smtp.gmail.com"
sender_email = input("Type your Email: ")  # Enter your address
password = input("Type your password: ") # sender mail password.
receiver_email = input("Type Receiver's Email: ")  #receiver address
message = input("Type Messege: ")

context = ssl.create_default_context()
with smtplib.SMTP_SSL(smtp_server, port, context=context) as server:
    server.login(sender_email, password)
    server.sendmail(sender_email, receiver_email, message)

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *