Skip to content

Commit 0a534c5

Browse files
authored
Merge pull request DhanushNehru#67 from rohannsrivastav/master
closes DhanushNehru#53
2 parents 248e253 + 5e55933 commit 0a534c5

File tree

4 files changed

+61
-3
lines changed

4 files changed

+61
-3
lines changed

Automating Emails/Birthday-Manager.py

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import csv
2+
import smtplib, ssl
3+
4+
message="""Hi {fname}, Wish you a very Happy birthday.
5+
Hope you had a great time."""
6+
7+
sender_address="forpythonbirthdayproject@gmail.com"
8+
sender_password="qwerty@12345"
9+
10+
context = ssl.create_default_context()
11+
with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as server:
12+
server.login(sender_address,sender_password)
13+
14+
with open(r"C:\Users\sriva\OneDrive\Desktop\VS Code\Python\birthday.csv") as file:
15+
reader=csv.reader(file)
16+
next(reader)
17+
for fname,lname,email,dob in reader:
18+
server.sendmail(
19+
sender_address,
20+
email,
21+
message.format(fname=fname),
22+
)
23+
24+
add=input(
25+
"""Do you wish to add or remove names to the csv file?
26+
if you want add names type add
27+
otherwise if you want remove names type remove
28+
if you wish to exit, type exit
29+
"""
30+
)
31+
32+
if add=="add":
33+
new_data=input("Enter data as first name,lastname,email,date of birth: ")
34+
new_data=new_data.split(",")
35+
with open(r"C:\Users\sriva\OneDrive\Desktop\VS Code\Python\birthday.csv",'r+') as file:
36+
writer_object=csv.writer(file)
37+
next(file)
38+
writer_object.writerow(new_data)
39+
elif add=="remove":
40+
lines=[]
41+
removal=input("Enter the first name of the person to be removed: ")
42+
with open(r"C:\Users\sriva\OneDrive\Desktop\VS Code\Python\birthday.csv",'r') as file:
43+
reader=csv.reader(file)
44+
for row in reader:
45+
lines.append(row)
46+
for fields in row:
47+
if fields==removal:
48+
lines.remove(row)
49+
with open(r"C:\Users\sriva\OneDrive\Desktop\VS Code\Python\birthday.csv",'w',newline="") as file:
50+
writer=csv.writer(file)
51+
writer.writerows(lines)
52+
53+
54+
55+

Automating Emails/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Automating-Emails-on-a-.csv-file
2+
<hr>
3+
Python program to automate an email personalized birthday message by reading details from a .csv file<br>
4+
Also includes options to add and remove details from said .csv file

Automating-Emails-on-a-.csv-file

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Incase you have anything to be followed while executing the python script mentio
1313
| Blackjack | https://github.com/DhanushNehru/Python-Scripts/tree/master/Blackjack | BlackjackGame.py - Plus, let's get 21. |
1414
| Chessboard | https://github.com/DhanushNehru/Python-Scripts/tree/master/Chess%20Board | Create a chesboard using matplotlib ChessBoard.py |
1515
| Compound Interest Calculator | https://github.com/DhanushNehru/Python-Scripts/tree/master/Calculate%20Compound%20Interest | calculate compound interest. |
16-
| Digital Clock | https://github.com/DhanushNehru/Python-Scripts/tree/master/Digital%20Clock | |
16+
| Digital Clock | https://github.com/DhanushNehru/Python-Scripts/tree/master/Digital%20Clock | Script to preview a digital clock on the terminal |
1717
| Fake Profiles | https://github.com/DhanushNehru/Python-Scripts/tree/master/Fake%20Profile | Get many fake profiles using python FakeProfile.py. |
1818
| File Encryption Decryption | https://github.com/DhanushNehru/Python-Scripts/tree/master/File%20Encryption%20Decryption | Encrypts and Decrypts files using AES Algorithms for Security purposes. |
1919
| Font Art | https://github.com/DhanushNehru/Python-Scripts/tree/master/Font%20Art | Display a font art using python FontArt.py. |
@@ -31,7 +31,7 @@ Incase you have anything to be followed while executing the python script mentio
3131
| Star Pattern | https://github.com/DhanushNehru/Python-Scripts/tree/master/Star%20Pattern | Create a star pattern pyramid |
3232
| Take a break | https://github.com/DhanushNehru/Python-Scripts/tree/master/Take%20A%20Break | Python code to take a break while working long hours TakeABreak.py |
3333
| Turtle Graphics | https://github.com/DhanushNehru/Python-Scripts/tree/master/Turtle%20Graphics | Code using turtle graphics |
34-
| Video Downloader | https://github.com/DhanushNehru/Python-Scripts/tree/master/Video%20Downloader | |
34+
| Video Downloader | https://github.com/DhanushNehru/Python-Scripts/tree/master/Video%20Downloader | Download Videos from youtube to your local system |
3535
| Wallpaper Changer | https://github.com/DhanushNehru/Python-Scripts/tree/master/Wallpaper%20Changer | Automatically change home wallpaper adding a random quote and stock tickers on it |
3636
| Website Cloner | https://github.com/DhanushNehru/Python-Scripts/tree/master/Website%20Cloner | Clone any website and open the site in your local IP |
3737
| Youtube Downloader | https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Downloader | Download any video from [youtube](https://youtube.com) in video or audio format!

0 commit comments

Comments
 (0)