tag:blogger.com,1999:blog-5861115221234125215.post4466899578037284076..comments2013-08-09T16:11:49.585-07:00Comments on Technolepsy: Multiple Recipient Delimiters in PostfixAnonymoushttp://www.blogger.com/profile/07400521320012839570noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5861115221234125215.post-91373922459919868052007-11-19T21:34:23.000-08:002007-11-19T21:34:23.000-08:00you don't need to (may not) list the pcre unde...you don't need to (may not) list the pcre under alias_database because pcre doesn't need to build db files from the 'source' file.<br><br>so delete the<br>alias_database = pcre:/etc/postfix/aliases-pcre<br>partalex kerkhovenoreply@blogger.comtag:blogger.com,1999:blog-5861115221234125215.post-43329038708794810712007-11-20T03:35:53.000-08:002007-11-20T03:35:53.000-08:00Thank you for pointing that out, Alex. I'll be...Thank you for pointing that out, Alex. I'll be doubly grateful if you can explain why 'source' files need to be listed in main.conf at all. (or do they not?)Garrisonhttp://codefix.netnoreply@blogger.comtag:blogger.com,1999:blog-5861115221234125215.post-79175746564548208682008-06-08T21:45:57.000-07:002008-06-08T21:45:57.000-07:00Thanks for the great hint! Regarding some details:...Thanks for the great hint! Regarding some details:<br><br>1. I note that it is just as easy to use POSIX regular expression maps (which are built-in) for such simple examples, see regexp_table(5).<br><br>2. It seems your map will just "lose" the extension. I haven't tested this, but I'm afraid it won't work with my set-up where I forward the address extension to procmail:<br><br> mailbox_command = /some/where/procmail -a "$EXTENSION"<br><br>Inside procmail, I can use this argument to filter mail, like this:<br><br> EXTENSION=$1<br><br> :0:<br> * EXTENSION ?? ^^housedepot^^<br> .Mailings/<br><br>3. So to avoid losing the extension, I took advantage of the fact that you can use backreferences in the result. In your table, it would look like this:<br><br>/^garrison\.([a-z0-9_]+)$/ garrison+$1Bruno De Frainenoreply@blogger.comtag:blogger.com,1999:blog-5861115221234125215.post-78058470361613890342008-06-09T04:05:28.000-07:002008-06-09T04:05:28.000-07:00Thanks for your comment, Bruno; your suggestion is...Thanks for your comment, Bruno; your suggestion is a fine alternative, but I can clarify a few points:<br><br>1. I choose PCRE simply because I am a perl programmer and I have given up trying to remember the differences between POSIX, PCRE, grep, sed, and awk regex engines. POSIX is more efficient (in this case), but PCRE eases my development.<br><br>2a. The map will lose the extension, but only for the delivery address, which happens anyway once 'foo+bar' fails (so it actually saves postfix a step). In all cases the mail headers are left intact so the mail is still addressed 'foo.bar'.<br><br>2b. Both setups should work with procmail and maildrop for the reason stated above (2a); however, I do quite a bit of automatic sorting, filtering, and forwarding with a custom delivery agent I wrote in perl with Mail::Audit. I should probably do a post about that.<br><br>3. Although keeping the extension is not strictly necessary, I strongly advocate that all readers modify my examples in the interest of maintainability for each local configuration.Garrisonhttp://codefix.netnoreply@blogger.comtag:blogger.com,1999:blog-5861115221234125215.post-50376406385678070012010-04-29T01:56:33.000-07:002010-04-29T01:56:33.000-07:00In fact, what Postfix disallows in address mapping...In fact, what Postfix disallows in address mapping is $number substitution, such as:<br><br>/^(\S)\.\S@domain\.com$/ $1<br><br>This applies to both aliases and virtual addresses, but non capturing regular expressions can indeed be used.<br><br>http://www.postfix.org/PCRE_README.htmlgarrisonhttp://codefix.netnoreply@blogger.comtag:blogger.com,1999:blog-5861115221234125215.post-73932288124856032582010-04-28T13:04:44.000-07:002010-04-28T13:04:44.000-07:00actually, newer postfix versions don't allow r...actually, newer postfix versions don't allow regular expressions for aliases anymore (security reasons).<br><br>Instead, the virtual table can be used:<br><br>1. create /etc/postfix/virtual-regexp:<br><br>/^garrison\.[A-Za-z0-9_]+@codefix\.net$/ garrison<br><br>2. in main.cf write:<br><br>virtual_alias_maps = hash:/etc/postfix/virtual, regexp:/etc/postfix/virtual-regexpjojonoreply@blogger.com