adsterra

Sending Mails using Python with Source code


 Sending Mails using Python 



Firstly you need to import smptlib module. smtplib contains some functions to send email using an existing SMPT server.It allows python to connect to an SMPT mail server,supply credentials as needed, and then send mail.

Steps:
import smtplib
# creates SMTP session
s = smtplib.SMTP('smtp.gmail.com', 587)
# Authentication
s.login("Sender_id", "Sender_Password")
# message to be sent
message = "This is a Test Message"
# sending the mail
s.sendmail("Sender_mailID", "Receiver_mailId", message)
s.quit()


Post a Comment

0 Comments