Introduction: Mail Sending Bot Using Python

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%.

Step 1: Calculating the Percentage of Attendance

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)

Step 2: Mail Sending Bot

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.

Step 3: Creating a Python File to Store Your Gmail Credentials

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

Step 4: FINALLY!!

You will receive a mail like this.

BEST OF LUCK!!

Step 5:

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.