diff --git a/birthday_wisher/README.md b/birthday_wisher/README.md deleted file mode 100644 index 7dc6fc811..000000000 --- a/birthday_wisher/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Bday Wish - -## Setup and activate virtual environment -For Unix based systems please execute the following command to create venv and install requirements. -``` -$ pip install -r requirements.txt -``` - -### Objectives -- [x] Telegram - birth_day_wish_telegram.py - Sends "Happy Birth Message to a Number" - - ##### Requirements - * Telegram API: Please refer to this [link](https://my.telegram.org/auth) - * Python - * A Smart Phone with telegram installed. - - ##### Usage: - `api_id`, `api_hash` and `token` should be applied within `birth_day_wish_telegram.py` - ``` - api_id = '' - api_hash = '' - token = '' - ``` - [ ] TODO: Improvement needed. - Desired date can be applide within `birth_day_wish_telegram.py`. - ``` - while True: - today = datetime.date.today() - if today != datetime.date(2020, 10, 15): - time.sleep(60 * 60 * 24) - else: - send_message("Happy Birth Day") - ``` - - simply execute the script: - ``` - python3 birth_day_wish_telegram.py - ``` - Please take `screen` and/or `tmux` into account. - -- [ ] Facebook - -- [ ] Twitter - -- [ ] Any further idea, Please open an [Issue](https://github.com/python-geeks/Automation-scripts/issues/new/choose) - - diff --git a/birthday_wisher/birth_day_wish_email.py b/birthday_wisher/birth_day_wish_email.py new file mode 100644 index 000000000..d7dc3ca80 --- /dev/null +++ b/birthday_wisher/birth_day_wish_email.py @@ -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) diff --git a/birthday_wisher/birth_day_wish_telegram.py b/birthday_wisher/birth_day_wish_telegram.py deleted file mode 100644 index 889f1d100..000000000 --- a/birthday_wisher/birth_day_wish_telegram.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 - -import datetime -import time - -from telethon.sync import TelegramClient -from telethon.tl.types import InputPeerUser - -api_id = '' -api_hash = '' -token = '' - -phone = '' - - -def send_message(msg): - client = TelegramClient('session', api_id, api_hash) - client.connect() - if not client.is_user_authorized(): - client.send_code_request(phone) - client.sign_in(phone, input('Enter the code: ')) - try: - receiver = InputPeerUser('user_id', 'user_hash') - client.send_message(receiver, msg, parse_mode='html') - except Exception as e: - print(e) - client.disconnect() - - -if __name__ == "__main__": - while True: - today = datetime.date.today() - if today != datetime.date(2020, 10, 15): - time.sleep(60 * 60 * 24) - else: - send_message("Happy Birth Day") diff --git a/birthday_wisher/requirements.txt b/birthday_wisher/requirements.txt deleted file mode 100644 index fd0a7dc5b..000000000 --- a/birthday_wisher/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -telebot==0.0.3 -Telethon==1.16.4 \ No newline at end of file