Skip to content

Updated birthday_wisher script to send out an automated email #960

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions birthday_wisher/README.md

This file was deleted.

47 changes: 47 additions & 0 deletions birthday_wisher/birth_day_wish_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env python3

import smtplib
import datetime
import time
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart


sender_email = "apeera786@gmail.com"
sender_password = "xxiz ccwg gqtl thhl"
recipient_email = "testswe271@gmail.com"
birthday_message = "Happy Birthday! 🎉🎂 Have a wonderful day!"

def send_email():
try:
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(sender_email, sender_password)

msg = MIMEMultipart()
msg['From'] = sender_email
msg['To'] = recipient_email
msg['Subject'] = "Happy Birthday!"

msg.attach(MIMEText(birthday_message, 'plain'))

server.sendmail(sender_email, recipient_email, msg.as_string())

server.quit()

print("Birthday message sent successfully!")
except Exception as e:
print(f"Failed to send email: {e}")


if __name__ == "__main__":
# The birthday date you want to send the message (year, month, day)
birthday_date = datetime.date(2024, 9, 30)

while True:
today = datetime.date.today()
if today == birthday_date:
send_email()
break
else:
time.sleep(60 * 60 * 24)
36 changes: 0 additions & 36 deletions birthday_wisher/birth_day_wish_telegram.py

This file was deleted.

2 changes: 0 additions & 2 deletions birthday_wisher/requirements.txt

This file was deleted.

Loading