View on GitHub

The Morning Mailer

A Beautiful HTML Email, delivered to you with the help of Python and the Magic of Cron

Download this project as a .zip file Download this project as a tar.gz file

Send an email to you every morning, any time of day for that mater, with the important information for your day.

Read the story of how this project came to be on my website, tompaulus.com


Download/Clone this Repo

To use this program you will need: 1. Python 2.6 or any later version of Python 2.x 2. A Server to Host your image files, It would be best if this script runs on that server 3. A linux computer/server to execute this script 4. A working SMTP account

Clone The Repo

$ git@github.com:tpaulus/MorningMailer.git

What the Email will look like.

Accounts

Todoist

A powerful task manager for personal productivity. Lets you manage tasks from your inbox, browser, desktop, or mobile device. For people who know great accomplishments are built through small daily tasks.

All that you need to do is to create an account and start tracking your tasks.

Weather Underground

The First Internet Weather Service! Sign up for their free "ANVIL PLAN" to get access to their stunning animated Radar Images and accurate weather forecasts. It's free, just don't request data less than 500 times per day, with a max of 10 calls per minute and you will be fine.

The New York Times

America's Newspaper You will need to request a free API Key for their "THE TIMES NEWSWIRE API", again free to use, as long as you don't exceed 5,000 calls pre-day at a max 8 calls per second.

Properties File

Web URLs

This script is designed to run on the server that hosts the files that will be displayed in the email.

Property.root_path = ''      # This is the internal path of the folder
                             # were the files that will be displayed in
                             # your emails is.
                             # ex. /home/tompaulu/public_html/img/
Property.root_web_path = ''  # This is the domain name of your server
                             # plus the folder the images are in.
                             # ex. http://tompaulus.com/img
Property.news = 'news'       # The name of the folder where the news
                             # pictures are locate. Use the Default
Property.weather = 'weather' # The name of the folder for the radar.gif map
Property.header = 'header'   # The name of the folder containing all the
                             # header images

API Tokens

This is where the tokens/API Keys you just got will go. We'll enter your Todoist data in the next step.

Property.wunderground = ''  # Your Anvil API key you got from Weather Underground
Property.nyt = ''           # Your Newswire API Key from the New York Times

Todoist

Todoist lets us login with our username and password to access the data; simply enter it in the appropriate fields.

Property.todoist_email = ''
Property.todoist_password = ''

Email

The script will send the email to the address you provide it when it has fetched your all data. This is the place where we will enter all that information.

Property.email_to = ''        # Your Email address,
                              # or the one where the email will be sent to
Property.email_subject = 'Good Morning'  # The Email's Subject
Property.email_server = ''    # The name of the server that handles your SMTP
                              # ex.  smtp.johndoe.com
Property.email_port = 0       # The port on which your SMTP server operates.
                              # ex. 25, 465, 587
Property.email_from = ''      # Who will the email be sent from
                              # Ex. <Python>python@myServer.com
Property.email_login = ''     # Login Info for the SMTP server, _if required_
Property.email_password = ''

User Info

Your info, used for weather information.

Property.user_TimeZone = ''  # You can leave this blank;
                             # Todoist should know your Time Zone
Property.user_city = ''      # Enter the city that you live in
Property.user_state = ''     # Enter the state that you live in 
                             # Use the 2 letter abbreviation. ex. CA

Server Settings

The last option is very important!

Property.on_server = True

Set this true if running on the server that hosts your files, it enables/disables 'wget' which downlaods the images.

Testing

You can test each of the services by running their scripts. They will either prompt you for a login, or use the information from the properties file.

Sending the Email

First try ending the email by manually running:

python ./main.py

It should run without errors, if there are errors, check to see if the login information is correct. If everything runs; check the email and make sure that all the images and text is correct.

CRON

Once everything works, you can setup an CRON job on your server. Set the time and other options, then tell it to execute this command:

cd <location of the cloned repo>; <path for python> ./main.py

Support or Contact

Submit an issue and I will try to help fix your problem. This is still a work in progress, but there should be no errors in this repository.

Check out my website http://tompaulus.com