monthly-reminder

A reminder which sets off only on weekdays!

Usage no npm install needed!

<script type="module">
  import monthlyReminder from 'https://cdn.skypack.dev/monthly-reminder';
</script>

README

Monthly Reminders

Set a recurring reminder on a specific day of the month. If the date falls on a weekend, the alarm (actually it's an email 😅) will go off on the next weekday (or the previous weekday if you choose so).

Table of Contents

Installation

You can install the package from NPM.

npm install --global monthly-reminder

After installing you need to add an entry to your crontab that will execute monthly-reminder daily. And to do that, we need to know the absolute path of monthly-reminder.

gt; which monthly-reminder
/usr/bin/monthly-reminder
gt; ls -l /usr/bin/monthly-reminder
lrwxrwxrwx 1 root root 56 Mar 22 10:48 /usr/bin/monthly-reminder -> ../lib/node_modules/monthly-reminder/monthly-reminder.js

Now we have all the information we need. Run crontab -e and schedule a daily job:

gt; crontab -e
# Make sure that you are setting the hour in your server's timezone.
# You can choose a different hour to receive the emails but the program must run daily.
0 9 * * * /usr/bin/monthly-reminder exec

Configuration

You need to create a config.json in the monthly-reminder directory. We found that directory in the previous step: /usr/lib/node_modules/monthly-reminder

Let's change the directory:

gt; cd /usr/lib/node_modules/monthly-reminder

There is an example config that you can copy and derive. config.json content should be like this:

{
  "nodemailer": {
    "host": "smtp.example.com",
    "port": 465,
    "secure": true,
    "auth": {
      "user": "username",
      "pass": "password"
    }
  },
  "defaultRecipient": "someone@example.com"
}

monthly-reminder uses Nodemailer to send emails. The nodemailer object in the config is passed to createTransport of Nodemailer without modification. You may need additional settings to send emails from your email provider. You can find all available configuration keys in Nodemailer documentation.

Usage

All available commands are listed in the general help section:

gt; monthly-reminder -h

Adding reminders

Set a reminder by running this command:

gt; monthly-reminder add --name "Pay the Bills" --date 19 --recipient me@email.com

Now the reminder is set. You will be reminded to pay your bills on 19th of each month (or the next business day where 19 is a weekend).

There are a couple of other settings and customizations that you can learn more about by visiting the help section.

gt; monthly-reminder add -h

Listing reminders

You can see a list of your reminders by running:

gt; monthly-reminder list

Deleting reminders

The command below will first list the reminders and then prompt you to choose which one(s) to delete. You can delete multiple reminders by separating them with commas.

gt; monthly-reminder delete

License

GNU General Public License v3.0 or later.

See COPYING to see the full text.