This Python script automates the process of sending email reminders based on a schedule defined in a TSV (Tab-Separated Values) file. It relies on the mutt email client to send emails on specific weekdays, dates, or monthly intervals.
mutt for email delivery.The script requires a tab-separated file located at /full/path/to/list.csv. The file structure must include the Subject and Occurrence headers.
Subject Occurrence
REMINDER: Someone's Birthday 01 Dec
REMINDER: Someone's Anniversary 22 May
REMINDER: Pay bills 01 Feb, 01 Apr, 01 Jun, 01 Aug, 01 Oct, 01 Dec
REMINDER: Do something 02 of every month
REMINDER: Check something Last day of every month
Ping Test Monday, Tuesday, Friday, Sunday
Weekly Meeting Wednesday
Edit the following variables within the script to match the environment:
Create ~/.muttrc and set the following, at a minimum:
set from = "from@example.com"
set realname = "bob"
set smtp_url = "smtps://from@example.com@mail.example.com:465/"
set smtp_pass = "real_password"
set ssl_force_tls = yes
# Optional - prevents the logging of sent emails in ~/sent
unset record
set copy = no
Make the script executable and run it:
chmod +x rem.py
./rem.py
To automate the checks daily, add an entry to crontab. For example, to run every morning at 08:00:
0 8 * * * /usr/bin/python3 /path/to/rem.py
echo "test body" | mutt -s "test subject" user@example.com.file_path variable to prevent issues when the script is triggered by a system scheduler like Cron.delimiter='\t'. Ensure the data file uses actual tab characters and not spaces.This project is made available under a GPL3 licence -- see COPYING for the full text.