Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e7b9644

Browse files
Auto BDay Wisher - GSSoC21#623
1 parent 9850a11 commit e7b9644

File tree

4 files changed

+94
-0
lines changed

4 files changed

+94
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import pandas as pd # Pandas library is used for importing and reading the data
2+
import datetime # datetime module is used for fetching the dates
3+
import smtplib # smtp library used for sending mail
4+
import os
5+
6+
current_path = os.getcwd()
7+
print(current_path)
8+
os.chdir(current_path) # Changing the Path of the directory in which you are currently working
9+
10+
GMAIL_ID = '</ Enter your email here />' # Give your mail here from which you want to send the wishes
11+
GMAIL_PSWD = '</ Enter password for your email here />' # Give your mail password
12+
13+
14+
def sendEmail(to, sub, msg):
15+
print(f"Email to {to} sent: \nSubject: {sub} ,\nMessage: {msg}")
16+
s = smtplib.SMTP('smtp.gmail.com', 587) # creating server to send mail
17+
s.starttls() # start a TLS session
18+
s.login(GMAIL_ID, GMAIL_PSWD) # the function will login with your Gmail credentials
19+
s.sendmail(GMAIL_ID, to, f"Subject: {sub} \n\n {msg}") # sending the mail
20+
s.quit()
21+
22+
23+
if __name__ == "__main__":
24+
df = pd.read_excel("data.xlsx") # the datasheet where the data of the friends is stored
25+
print(df)
26+
today = datetime.datetime.now().strftime("%d-%m")
27+
yearNow = datetime.datetime.now().strftime("%Y")
28+
29+
writeInd = []
30+
for index, item in df.iterrows():
31+
bday = item['Birthday']
32+
bday = datetime.datetime.strptime(bday, "%d-%m-%Y")
33+
bday = bday.strftime("%d-%m")
34+
print(bday)
35+
if(today == bday) and yearNow not in str(item['LastWishedYear']):
36+
sendEmail(item['Email'], "Happy Birthday", item['Dialogue']) # calling the sendmail function
37+
writeInd.append(index)
38+
39+
if writeInd != None:
40+
for i in writeInd:
41+
oldYear = df.loc[i, 'LastWishedYear']
42+
df.loc[i, 'LastWishedYear'] = str(oldYear) + ", " + str(yearNow)
43+
44+
df.to_excel('data.xlsx', index=False)

‎Auto Birthday Wisher/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Auto Birthday Wisher
2+
3+
One forgets to send birthday wishes to friends many times. At such times an automatic birthday wisher comes handy. An automatic birthday wisher via email makes one's life easy. It will send the birthday wishes to friends via email automatically via a server and using an excel sheet to store the data of friends and their birthdays along with email id. It'll send the wishes to friends for all the upcoming years untill we stop the server.
4+
5+
## Setup instructions
6+
7+
In order to run this script, You just need the following modules:
8+
9+
- **Pandas** Pandas is a fast, powerful, flexible and easy to use open source data analysis and manipulation tool,
10+
built on top of the Python programming language.
11+
```bash
12+
pip install pandas
13+
```
14+
15+
- **OpenPyxl** Openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files.
16+
```bash
17+
pip install openpyxl
18+
```
19+
20+
- **datetime** It is a module used for Encapsulation of date/time values.
21+
```bash
22+
pip install DateTime
23+
```
24+
25+
- **smtplib** It is a set of Python modules designed for writing video games.
26+
27+
## Configuration
28+
1. Assign the Gmail Id of sender to the GMAIL_ID variable in *line 10* of *"Auto B'Day Wisher.py"* file. (e.g. 'xyz@gmail.com')
29+
2. Similar to first step assign the Gmail password of sender to the GMAIL_PSWD variable in *line 11* of *"Auto B'Day Wisher.py"* file. (e.g. '1234')
30+
3. In *"data.xlsx"* file insert the name of the receiver in second column under *Name*. Similarly update the *Birthday field with the birth date of receiver* in the given format("%dd-%mm-%YYYY"). Update the *Dailogue* field with a short message you want to send and the *Email* field with the email of the receiver.
31+
4. Make sure to give permission to your google account from which you're sending email to *Allow less secure apps*. Just turn this "ON" from
32+
```bash
33+
https://support.google.com/accounts/answer/6010255?hl=en#zippy=%2Cif-less-secure-app-access-is-off-for-your-account
34+
```
35+
5. Run the command
36+
```bash
37+
python "Auto B'Day Wisher.py"
38+
```
39+
40+
## Screenshots
41+
42+
<p align="center">
43+
<img src="#" alt="Email received by friend"/>
44+
<br>
45+
Birthday Wishes received by the Friend via Email
46+
</p>
47+
48+
## Author
49+
50+
[Vishal Patil](https://github.com/SpecTEviL)

‎Auto Birthday Wisher/data.xlsx

5.02 KB
Binary file not shown.

‎Auto Birthday Wisher/emailReceived.jpg

181 KB
Loading[フレーム]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /