Sending Mailcow Alias/Tags to an Inbox Folder

I have been trying to have an alias (short@domain.tld) forward an inbound email to a plus address (me+lowpriority@domain.tld), as then it can be tagged and filtered to a different inbox.

Sending Mailcow Alias/Tags to an Inbox Folder

Following on from my other post on Mailcow DKIM issues following a server migration, I’ve been expanding my customisation of my Mailcow e-mail server. My current goal is to reduce the amount of low priority emails landing in my inbox.

I have been trying to have an alias (short@domain.tld) forward an inbound email to a plus address (me+lowpriority@domain.tld), as then it can be tagged and filtered to a different inbox. Mailcow however will forward the email to the main inbox and ignore the tagged address. Read on to see how Sieve Filters can be added to resolve this.


Plus Addressing

This also goes by Sub-Addressing (RFC 5233 term) or Mailcow calls it ‘Tagging’.

Plus addressing allows us to use a plus symbol (+) in an email address to filter emails sent to that address. This is a helpful tool by itself to manage our mailbox.

In Mailcow you can either include that tag name in the subject of the email (eg [tag] email subject) or move the email to a separate inbox sub-folder.

An example plus address is me+twitter@domain.tld.
In this case, ‘twitter’ is the tag and depending on the user settings, the email will either have the subject changed to include [twitter] or moved to a sub-folder called ‘twitter’.

Mailcow user settings for tagged emails

This feature has existed for many years in Google and is now being rolled out to all Office365 tenants as default.


Plus address as an alias recipient

I wanted to take things a bit further. I want to send emails to shortaddress@domain.tld and have this delivered to a sub-folder in my inbox.

Why?

I like to keep clutter to a minimum so by having all my lower priority emails move to a sub-folder, I can reduce the amount of emails in my primary inbox.
Plus, if we ever make it to trade shows again after COVID-19, giving out ‘short@domain.tld’ is much easier than a full name, and nobody gets your direct email!

To do this,

  1. Create an alias for 'short@domain.tld' to 'me+shortaddress@domain.tld'.
    This can be completed in the Mailcow Admin panel, Mail setup under 'Aliases' tab.
  2. Add a sieve post-filter by moving to the 'Filters' tab.
    Click 'Add Filter'
    Give the sieve filter a name, select 'postfilter' in the dropdown and then modify and use the below code to configure the filter.

There are two different filter sieve options you can choose from below. The first uses the 'Delivered-To' header and should use the final email address (the plus address) which the alias forwards to.
The second option uses the 'To' header, where the email was sent...'to'. This is the alias we created earlier.

require ["fileinto", "mailbox"];
if address :contains "Delivered-To" “me+shortaddress@domain.tld” {
   fileinto :create "INBOX/SubInboxName”;
}

or

require ["fileinto", "mailbox"];
if address :contains "To" “short@“domain.tld {
   fileinto :create "INBOX/SubInboxName”;
}

Testing

If you decide to alter or improve the sieve rules, it’s a good idea to test them before putting into production.

You’ll need to visit this sieve tester
https://www.fastmail.com/cgi-bin/sievetest.pl. Be sure to bring the full text source of the email you want to test with the rule!


End

Now we have a short address which can be used when you are signing up to newsletters, shows, purchases, mailing lists when you don't want your main inbox used!