Skip to main content

Send Email Through Python



1. Install Pycharm Community edition in your system.

link:https://www.jetbrains.com/pycharm/download/#section=linux

2. open file in new Project and Save the code

Change the sender address and Receiver address according to the requirement.

import smtplib

content = 'example mails for test'mail=smtplib.SMTP('smtp.gmail.com',587)
mail.ehlo()
mail.starttls()
subject = 'subject'mail.login('sender address','password')
mail.sendmail('sender address','receiver address ',content)
mail.close()

Comments