January 23rd, 2014, 05:46 AM
Dovecot/Sieve, automatic folder creation for alias addresses
I am running my own Debian-based mailserver using the apparently popular postfix/dovecot combination.
I am basically serving a couple of domains, two of them with a special use for me:
My main mail address is mail at mydomain.tld. I use a second domain, dummydomain.tld for "special" (lacking a better word here) cases.
Let's say I want to register to a website called Special Shop. I then register there using the mail address specialshop at dummydomain.tld. This mailbox does not actually exist, anything arriving at my server for @dummydomain.tld gets redirected to email@example.com (Btw, your forum rules parser apparently is not RFC compliant ). I then use Sieve to sort everything containing +catchall into my catchall mail folder.
As you can imagine, my Catchall folder has become quite full. I usually create a subfolder and a corresponding sieve rule so that future mails for an alias gets sorted into the respective subfolder.
What I'm wondering is if this could be automated. Can I make dovecot or maybe sieve evaluate and parse the original To header and create a new folder for every alias that does not already have a corresponding one? So that the first mail to specialshop at dummydomain.tld, which gets delivered to firstname.lastname@example.org will automatically create a new folder and all subsequent mail will automatically be sorted into this new folder without manual intervention? If so, how would I do this?
I hope I made my usecase clear enough, please ask if there are any questions left.
Thanks for your help.