MOHAN KRISHNA

0 %
Mohan Krishna
Multimedia Professional
Ai & ML Researcher & Enthusiast
  • Residence:
    India
  • City:
    Vijayawada
  • Age:
    46
AI/ML Enthusiast. New Media Trainer, VFX Artist, Non Linear Video Editor, Graphic Designer, Sound Editor and iOS App Designer.
Telugu
English
Hindi
Tamil
Proficiency:
Graphic Design
Web Design
Video & VFX
Machine Learning
Artificial Intelligence
Digital Marketing
Areas of Interest:
Take a look at some of the things I love working on.
  • Non Linear Video Editing
  • Graphic Design
  • Web Design
  • Audio Editing
  • Content Management Systems
  • Python
  • Deep Learning
  • OpenCV
  • Image Classification

Auto Birthday Wishes

September 10, 2022
# pillalamarri.in - python projects
# Pandas library is used for importing and reading the data
import pandas as pd
# datetime module is used for fetching the dates
import datetime
import smtplib															# smtp library used for sending mail
import os

current_path = os.getcwd()
print(current_path)
# Changing the Path of the directory in which you are currently working
os.chdir(current_path)

# Give your mail here from which you want to send the wishes
GMAIL_ID = input("Enter your email: ")
# Give your mail password
GMAIL_PSWD = input("Enter password for your email mentioned above: ")


def sendEmail(to, sub, msg):
    print(f"Email to {to} sent: \nSubject: {sub} ,\nMessage: {msg}")
    # creating server to send mail
    s = smtplib.SMTP('smtp.gmail.com', 587)
    # start a TLS session
    s.starttls()
    # the function will login with your Gmail credentials
    s.login(GMAIL_ID, GMAIL_PSWD)
    # sending the mail
    s.sendmail(GMAIL_ID, to, f"Subject: {sub} \n\n {msg}")
    s.quit()


if __name__ == "__main__":
    # the datasheet where the data of the friends is stored
    df = pd.read_excel("data.xlsx")
    today = datetime.datetime.now().strftime("%d-%m")
    yearNow = datetime.datetime.now().strftime("%Y")

    writeInd = []
    for index, item in df.iterrows():
        bday = item['Birthday']
        bday = datetime.datetime.strptime(bday, "%d-%m-%Y")
        bday = bday.strftime("%d-%m")
        if(today == bday) and yearNow not in str(item['LastWishedYear']):
            # calling the sendmail function
            sendEmail(item['Email'], "Happy Birthday", item['Dialogue'])
            writeInd.append(index)

    if writeInd != None:
        for i in writeInd:
            oldYear = df.loc[i, 'LastWishedYear']
            df.loc[i, 'LastWishedYear'] = str(oldYear) + ", " + str(yearNow)

    df.to_excel('data.xlsx', index=False)
# pillalamarri.in - python projects
Posted in PythonTags: