Mail Sending Bot Using Python

by killeraj69 in Circuits > Websites

1998 Views, 1 Favorites, 0 Comments

Mail Sending Bot Using Python

del.png

In this project you will learn how to send mails using python .Here i have demonstrated an project which can be used to tell if you have sufficient attendance to take a leave from collage/school or not .Here i have assumed minimum percentage of attendance is 75%.

Calculating the Percentage of Attendance

Screenshot (43).png

Here i have used some basic coding to calculate the attendance.When we compile the code First we put total number of classes then number of classes attended (I know nobody would wake up and use this python code to know this attendance but it can be refereed for your other projects)

Mail Sending Bot

Screenshot (45).png
Screenshot (46).png

STEPS:-

1)we import all the variables from the above attendance python code.

2)we import "smtplib" for SMTP client session to be used to send mail to any Internet machine with an SMTP.

3)we make another file named "config" which will stored the gmail id and password.(I have used gmail you can use any other email service)

4)coding to send a mail with Subject as well as message.

5)In the first picture shown there are prerequisites for sending a mail.In the second picture we coded to send mail with some specific data i.e. pre written subject and body of email.Here i have just added a few lines but you can edit it to perform more task.

6)I have used if and else statements to send a mail whether i should go to class or not.

Creating a Python File to Store Your Gmail Credentials

Screenshot (44).png

Make a python code named config and store the data as shown above.

FINALLY!!

Screenshot (47)_LI.jpg

You will receive a mail like this.

BEST OF LUCK!!

These are the codes required.

I have written this script actually for another project in which if a person enters a room we will receive a mail to and we can send mail to change password for a door lock which will be made using raspberry pi and arduino .

you can use it for your projects too.