Is there a way to configure Postfix to accept any mail for a domain (catch-all), and then forward that email to the same recipient at a different domain, ignorant of whether the recipient actually exists?
I use Postfix with a MySQL backing for virtual accounts.
No this is not directly possible. There is one exception how it can work described in http://www.postfix.org/ADDRESS_REWRITING_README.html#luser_relay
Another crude solution would be to use SQL (substr + concat) to handle this for you in the
virtual_alias_maps
.Edit: Oh. There is one last possibility. Use the policy delegation mechanism and return
REDIRECT [email protected]
where you need it andDUNNO
if you don't want to rewrite.Edit 2: Inspired by Squidly (but his solution does not work!) you can setup
and in that file put
(Watch out for the escaped dot (\.) in the first column.) Personally I would prefer this version.
The pcre table type is unavailable on my system, so I did the following:
In
/etc/postfix/main.cf
:In
/etc/postfix/virtual
:Not directly possible? I found it very simple and direct with no SQL, regular expressions, or policy mechanisms.
In
main.cf
:In
/etc/postfix/virtual
:Sending a test e-mail from the server:
And the actual result in mail.log (I have amavis on port 10025 running):
Key line separated for emphasis:
If you use MySQL as the storage end, I believe that you can specify a catch all forward like this:
Table Forwardings
If I read the documentation right, it would mean that [email protected] will now be forwarded to [email protected], etc.
I found this in this howtoforge tutorial
Depending on how you setup your Postfix you may be able to use an alias to forward all mail.
edit
Also you can setup a redirect that will do it for you easily.
In /etc/postfix/main.cf add this:
Then in /etc/postfix/forward_bcc.pcre add this:
This is a bit of a hack but it will work for forwarding specific users from one domain to another.
You also may want to look at this page for how to do some rewriting within Postfix it's self.