0

I have an email domain name.sld.tld, that I wish to catch most (excl admin, webmaster, and other spam targets) emails sent to *@name.sld.tld and either:

  • Forward them to another email account running in Gmail such that the address is rewritten from [email protected] to [email protected]
  • OR automatically filter the emails based on the incoming alias into a folder/label of the corresponding alias, creating one if it doesn't already exist. ie, no intermediary forward (preferred option)

Why? Something akin to what @SwiftOnSecurity tweets about here. I've tried tweeting them how they do it, but got no response:

I figure I probably need to write something myself to do it, but if @SwiftOnSecurity is doing it, there has to be a simple way OOTB from something, right?

It seems like its the email equivalent to mod_rewrite that I wish to achieve.

2

2 Answers 2

2

There is a solution that seems tu do exactly whjat you want: the cyrus IMAP server together with its sieve implementation.

Sieve basically is a server-sided domain-specific scripting language, that allows you to create elaborate rules for finding a target folder for an email. Its intended use is to auto-sort e.g. mailing list mails into their respective IMAP folders, but since any header can be used as a criterion, you can also use the receiver.

A complete setup would consist of

  • a cyrus IMAP server
  • an MTA configured to accept (nearly) all mail for a domain and deliver it to the same IMAP mailbox
  • DNS setup to make this MTA the responsible MX for the domain
  • your choice of sieve scripts to sort the mails into the folders

I have been using such a system to auto-sort many of my mails for years.

4
  • Hrmm this is definitely what I'd like to be able to do, but I don't wish to run my own email server... if only I could use sieve scripts with Gmail or Office 365 and I'd have my solution! Do you know if you can wire up a sieve implementation with GMail's IMAP endpoint?
    – Ashley
    Mar 5, 2015 at 17:41
  • Sieve comes when mail is delivered to an IMAP server, not when it is read from it. So GMail's IMAP endpoint is of no use - it goes to the wrong side of the process. Mar 5, 2015 at 23:42
  • fastmail.com seems to support Sieve out of the box, and has a very Gmail-esque interface. They're also an Australian company, despite servers being hosted in the US, hopefully means they're a bit more protected from NSA interception (but really, email isn't a good way to think you're secure)
    – Ashley
    Mar 6, 2015 at 14:23
  • I have ended up signing up for fastmail.com they suit my need perfectly. I can create folders in the web interface, and immediately start having email received into them using their dot and plus addressing mechanism. Also useful to understand is their mail flow/email delivery.
    – Ashley
    Aug 3, 2015 at 16:47
1

I have ended up signing up for fastmail.com as they suit my need perfectly. I can create folders in the web interface, and immediately start having email received into them using their dot and plus addressing mechanism. Also useful to understand is their mail flow/email delivery.

For example: with the right folder hierarchy already created, emails sent to address [email protected] would automatically be delivered to INBOX\Alpha\Beta\Gamma without any manual rules needing to be configured. The only downside is that you can't have folders automatically generated based on incoming emails, but imagine that's to prevent abuse.

The way I'm using this is such that I can set up category folders, such as social or payments and then can refer to them with service-specific email addresses: [email protected], [email protected].

Fastmail uses Sieve, Cyrus and some custom development in the background, hence leaving the original answer as chosen

2
  • Hey. Would you mind sharing what your Sieve config looks like for the hierarchy sorting?
    – Xælias
    Jan 15, 2018 at 0:26
  • @Xælias unfortunately that's all handled by Fastmail; I don't have a Sieve config it just does it for me built-in to the product. They're fairly receptive, so they might give that information if you ask?
    – Ashley
    Jan 15, 2018 at 15:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .