Configuring Push Notifications from Fastmail

(posted in tech)

This post documents the process that I’m using to receive Pushbullet alerts on my phone for emails with a specific sender or subject line. The purpose of this setup is to continue getting phone alerts for these emails even though I am automatically filing them into a sub-folder that my phone’s email client is not set up to monitor.

This setup relies on using a few different services:

I’ll show you how I wrote my Fastmail sieve script to send alerts to IFTTT and append a tag to the subject line in order for IFTTT to trigger a Pushbullet notification. You probably shouldn’t rely on this for mission-critical alerts, as three separate services means three possible points of failure.

Fastmail Filter

I use Fastmail as my email provider because I care about privacy, and don’t trust any of the big free email providers to respect that. I’d rather my email provider make their money directly through me paying them than indirectly by selling my data or pushing ads based on the content of my inbox. It’s a personal preference, and if you disagree with it then that’s fine. I’ll be the one laughing when we’re all finally imprisoned and enslaved by our sentient Google-bot overlords.

Fastmail has a simple rule builder for filtering, forwarding, or autoresponding to emails that match certain criteria. Their rule builder is just a GUI that sits on top of a more powerful Sieve-based filtering system. In order to unlock its full potential, log into Fastmail and go to Advanced->Rules in the settings menu, then click the “View filter source” button at the bottom of that page. Keep in mind that once you manually customize your filter script, you won’t be able to make changes through the simple rule builder GUI anymore without losing your customized stuff. Once you know how to write your own Sieve filter, you won’t need the simple GUI anyway.

Here’s what my filter more or less looks like (omitting the default Fastmail spam boilerplate stuff at the top and some other irrelevant domains):

# handle junk mail that I want to keep
# but don't want in my inbox
if anyof (header :contains "from" [
], address :all :is "from" [
]) {
    fileinto "INBOX.Archive";

# filter cron output to server noise folder
elsif header :contains "from" "(Cron Daemon)" {
    fileinto "INBOX.Server Noise";

# filter GNU status alerts to server noise
# after sending #gnusocial tagged email to IFTTT
elsif header :contains "from" "GNU Social" {
    notify :method "mailto" :options [""] :message "GNUSocial / GNU Social #gnusocial / $subject$";
    fileinto "INBOX.Server Noise";

# filter Monit alerts to server noise
# after sending #monit tagged email to IFTTT
elsif header :contains "subject" "monit alert --" {
    notify :method "mailto" :options [""] :message "Monit / Monit Alert #monit / $subject$";
    fileinto "INBOX.Server Noise";

In section 1 I’m just automatically moving emails from specific domains or addresses directly to my archive folder, because I generally want to keep those but don’t want them in my inbox where my phone is going to beep at me when they land.

Section 2 is similar, but I’m filtering output from cron jobs on my server into a Server Noise folder.

Sections 3 and 4 are the money sections. Similarly to section 2 I am matching GNU Social and Monit alerts based on the sender or subject and filing them into my Server Noise folder, but first I’m using Fastmail’s custom notify Sieve extension to trigger some IFTTT recipes. You can see that the array following the :options specifier contains the destination email address (in this case IFTTT’s trigger email). The section following the :message specifier is of the form "SENDER / SUBJECT / BODY". The important thing to note is that the SUBJECT section is where I’m appending the #gnusocial and #monit tags, which is how I differentiate between the triggers in my IFTTT rules. In both cases I only care about the subject of the original email, so I pass that as the body of the email to IFTTT using the $subject$ variable.


You will need to already be signed up for Pushbullet and have activated the Pushbullet channel on your IFTTT account before creating the rules. Once you have that done, this piece of the puzzle is fairly straightforward.

Create a new rule, and choose “Email” as the “this,” and pick the “Send IFTTT an email tagged” option. When it prompts for the tag, use the one you specified in the Sieve notification. In my case, I entered #gnusocial for one of my rules and #monit for the other.

After creating the trigger, choose “Pushbullet” as the “that,” and pick the “Push a note” option. You can then choose which portions of the notification email you want to include in the Pushbullet notification. In my case, for the #gnusocial tag I include both the {Subject} and {Body} in their respective fields, but for the #monit alert I just put {Body} into the subject of the alert (since it already includes “monit alert –” in the subject of the original email that Monit sends).

The Result

Now whenever GNU Social or Monit send me an email, they get filed into my Server Noise folder, and a new outgoing email is sent to IFTTT which triggers a rule that sends the subject of the original email to my phone using Pushbullet. This means I can get notifications for those emails without having them clutter up my Inbox, and without having to configure my email client to watch whatever folder I’m filing them into (which I couldn’t do as-is anyway without also getting notifications whenever cron jobs generate output on my server, which I definitely do not want).

So if you’re like me and you need complete anal-retentive control over your email organization, but still want to get selective push notifications about emails based on the subject or sender, you should now have a pretty good starting point. There’s probably a way to do this using Gmail, but you should really just stop using Gmail. For real. IFTTT supports other push notification services like Pushover or even SMS if you don’t use Pushbullet, so there are other options (assuming you don’t mind using IFTTT). In fact, Fastmail’s notify extension also supports :method "sms" instead of emails, but they’ll charge you for each outgoing SMS.

Short Permalink for Attribution: