Skip to content

The program get the info form the users and send them an email with a joke , everyday at 8:00 AM.( PostgreSql, Python anywhere, Tkinter)

License

Notifications You must be signed in to change notification settings

Giuseppe-Bonifati/Morning_Jokes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MORNING_JOKES ☀️

Description

The program will send an email with a random Joke to the user, every morning at 8:00 AM.

Installation 📦

In order to run the program please follow the instructions 🏁:

Files

We need to create 3 different files

▪️ joke.py (Allows us to ask to the users to enter the data and save it in the database)

▪️ main.py (Will send an email with a random Joke to the users using smtplib and an api)

▪️ hidden.py (Containt the information about the database)

❗ IMPORTANT : Create a database connection in the file hidden with all info about the db , we will need this info in the main.py and joke.py

def db_connection():
    return {"database":"",
                        "host":"",
                        "user":"",
                        "password":"",
                        "port":""}

Api

https://official-joke-api.appspot.com/random_joke

Email ✉️

Before to lunch the program we need to create an email ( the sender )

https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail

with smtplib.SMTP("smtp.gmail.com",587, timeout=120) as connection:
        connection.starttls()
        connection.login(user=test_email, password=test_password)

'''
SMTP host for different email addresses:

smtp.aol.com
smtp.mail.att.net
smtp.comcast.net
smtp.mail.me.com
smtp.gmail.com
smtp-mail.outlook.com
smtp.mail.yahoo.com 

'''    

Then it is important to follow this example with gmail, steps by step to configure your email address

🔹1. In Your gmail Webpage, after the login, on the top right of the screen click on the icon and then Manage your Google Account

image

🔹2. Click on the Security/Safety

image

🔹3. Enable two step verification and follow the instructions from gmail

image

🔹4. Then go back on Security/Safety and click on Add password

image

🔹5. After you add the password click on Select app and chose "Other" , type a name and click on Generate

🔹6. Copy the generated password and paste it into file joke.py in test_password = ""

Python anywhere

To run the program everyday at 8:00, we need to run the program in the could , in this case in python anywhere .

So in python anywhere add the file in the could , then start a new bash console and then schedule the task to be executed at the time that you want in this case at 8:00 AM

GUI ▪️▫️

The Graphical User Interface ( GUI ) will look like this:

image

License

About

The program get the info form the users and send them an email with a joke , everyday at 8:00 AM.( PostgreSql, Python anywhere, Tkinter)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages