:: SIMPLE PYTHON CODE FOR SENDING EMAILS AUTOMATICALLY ::
- In order to Send emails through python3 , we use SMTP Serever libraries.
- I want to see an acknowledgement if eamil has sent else notify me !!.. soo i'm using "try" & "exception " conditions
NOTE : TO GET EMAIL RECEIVER ACCOUNT YOU SHOULD ALLOW YOUR LESS SECURE APPS ....(link given below)
| CODE :
import smtplib
sender='snehitvaddi@gamil'
receiver='pujithvaddi@gmail'
message="""
From :<senders email>
To: <receivers email>
subject: 'An automatic email'
<h>THIS IS HEADING</h>
<b>THIS IS BODY</b>
"""
# NOTE : Here (""") indicates Multiline strings
try:
server=smtplib.SMTP('smtp.gamil.com',587)
server.sendmail(sender,receiver,message)
print('MAIL HAS BEEN SUCCESSFULLY SENT')
exception SMTPException:
print('Sorry,mail has been not sent !!')
CODE BY: SNEHIT VADDI |