Skip to content

nzeid/radicale-email-reminder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Radicale Email Reminder
=======================

A standalone script designed to run repeatedly against a Radicale
collection to send email reminders that match VALARMs nested in
ICS/iCalendar files.

The objective is to simply send emails along with any alert/alarm that
is specified in any calendar event or to-do item. Very few open source
CalDAV servers support such email notifications out-of-the-box. This
project effectively allows any iCalendar VALARM to double as an email
alert.

This script supports *all* RFC 5545 VALARM use cases, and properly
implements email reminders for both repeating and expiring events.



Requirements
------------

- Radicale <https://radicale.org/>
- icalendar <https://pypi.org/project/icalendar/> (should have already
  installed alongside Radicale)
- Cron or Schtasks



Setup
-----

There really isn't much to lay out. When setting up Cron or Schtasks,
simply specify the proper Python command. For Cron:

* * * * * radicale python /var/lib/radicale/radicale_email_reminder.py /var/lib/radicale/collections/collection-root 1 ::1 25 'Radicale Reminder <admin@smith.net>' > /dev/null

This will run "radicale_email_reminder.py" (which happens to be
located in "/var/lib/radicale/") once a minute. Read further for
information about the script's arguments. It might also be cleaner to
move that bulky command into its own shell script where you can break
lines and make other improvements.



CLI Usage
---------

python radicale_email_reminder.py <directory> <minutes ahead> <mail server host> <mail server port> <from address>

<directory>

  Ideally this should be the path to the root Radicale collection. This
  script is actually agnostic to the CalDAV server itself. The given
  directory must simply contain the ICS/iCal files that are managed by
  any server.

<minutes ahead>

  When the script runs, it must calculate the window in which VALARMs
  must fall so that their emails are sent. The window always starts at
  the zeroth second of the minute it runs. E.g. if the script starts at
  2019-03-06T09:00:32.856Z (bear with me), and <minutes ahead> is "2",
  then it will send emails for all VALARMs that fall exactly *at* or
  *later* than 2019-03-06T09:00:00Z, and exactly *earlier* than
  2019-03-06T09:02:00Z. VALARMs *at* exactly 2019-03-06T09:02:00Z will
  *not* be sent. This is to eliminate the possibility of duplicate
  emails when the script runs again at say 2019-03-06T09:02:15.283Z, in
  which case the window will be greater than or equal to
  2019-03-06T09:02:00Z and strictly less than 2019-03-06T09:04:00Z. So
  yeah, every 2 minutes without repetition.

<mail server host>

  So in order for emails to go out at all, an SMTP server must be
  specified. This script is meant to be as simple as possible, so
  chances are you will be deploying this with some cookie-cutter mail
  setup over a local network/host.

  - SMTPS and other historical protocols are *not* supported.
  - Authentication of any kind is *not* supported.
  - STARTTLS *is* supported it's easy.

<mail server port>

  Port for the aforementioned host. As this script does not support
  authentication, this will likely be "25".

<from address>

  The sender of the notification emails. Should follow the standard
  <https://tools.ietf.org/html/rfc5322#section-3.4>. E.g.:

  Radicale Reminder <admin@smith.net>

  In other words, should simply follow all the best practices for
  outgoing email.



Setting an Email Reminder
-------------------------

By now you're wondering where to specify the recipients of email
reminders. In technical terms, a special syntax must be entered at the
*top* of the "DESCRIPTION" in the VEVENT or VTODO closures in an iCal
file, like so:

DESCRIPTION:Notify:\nsmith@smith.net\nSomeone <someone@mymail.com>\n-\n\nTh
 is is a note/description/detail of the event.

From a UI like InfCloud, it will be the "Note" section when creating a
new calendar event or to-do item. The example above was generated by
the following "Note":

  Notify:
  smith@smith.net
  Someone <someone@mymail.com>
  -

  This is a note/description/detail of the event.

Notice the "Notify:" (yes, with the colon), followed by a new-line,
followed by new-line separated email addresses, followed by a final
new-line, then a dash. An email will be sent for this event containing
the description "This is a note/description/detail of the event." and
omitting the notify section.

Don't forget to also set the actual alerts/reminders. Specifying a
notify section without adding any actual VALARMs will obviously do
nothing. In InfCloud they are each called "Alert".



Contributing
------------

Please communicate changes over this project's GitLab/GitHub
pages. Bear in mind that this is not and never will be a large-scale
project, and the GitLab/GitHub pages are merely mirrors of a separate
"official" repository. Any accepted changes will get due authorship
and credit.

https://gitlab.com/nzeid/radicale-email-reminder
https://github.com/nzeid/radicale-email-reminder



License
-------

Copyright (c) 2019 Nader G. Zeid

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/gpl.html>.



Acknowledgments
---------------

Special thanks to the awesome work by the Radicale <https://radicale.org/>
and icalendar <https://pypi.org/project/icalendar/> teams. And a
thanks-as-always to the Python Software Foundation.

About

A standalone script for Radicale to send email reminders matching VALARMs in ICS/iCalendar files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages