I've set up my mail server using a guide from Digital Ocean, followed by another guide. So, now if I send mail to torvin@mydomain
, it works.
Now I'm trying to set up a catch-all address for all undelivered mail. Things I've tried so far:
1) Replaced
local_recipient_maps = proxy:pgsql:/etc/postfix/pgsql-boxes.cf $alias_maps
line with this:
local_recipient_maps =
luser_relay = torvin
The result I see in the logs:
postfix/lmtp[32692]: D5AD540085: to=, relay=mail.mydomain[private/dovecot-lmtp], delay=0.21,
delays=0.17/0.01/0.01/0.02, dsn=5.1.1, status=bounced (host
mail.mydomain[private/dovecot-lmtp] said: 550 5.1.1
User doesn't exist:
thisisjustatest@mydomain (in reply to RCPT TO command))
2) Instead replaced
alias_maps = hash:/etc/aliases proxy:pgsql:/etc/postfix/pgsql-aliases.cf
with
alias_maps = hash:/etc/aliases pcre:/etc/aliases_pcre proxy:pgsql:/etc/postfix/pgsql-aliases.cf
And created /etc/aliases_pcre
with the following content:
/.*/ torvin
Result is the endless loop of:
to=, relay=local, delay=0.01, delays=0/0/0/0,
dsn=5.4.6, status=bounced (mail forwarding loop for torvin@mydomain)
3) Instead tried
virtual_alias_maps = pcre:/etc/aliases_pcre
Now all my mail goes to torvin
, and never gets delivered to any other existing users in the system.
Please help!
Best Answer
This is because
/.*/
also includestorvin
. I assume yourproxy:pgsql:
has information on this user, butpcre:/etc/aliases_pcre
is looked before that. In this case, the easiest solution would be to reorder them. Also, a simplehash:
database line@example.com torvin@example.com
would do the same as your/.*/
PCRE approach.Technical implementation aside, having such a catch-all on a domain with multiple users is a bad idea. There would not be ANY actual messages that would need attention. What you'd get is:
sales@example.com
. This is the most common.<j.smith@example.com>
, but forgets the dot<jsmith@example.com>
or mistypes it like<j.smiht@example.com>
. Normally, the sender would receive a notification that the user doesn't exist, double check the email address and resend the message. With a catch-all, this doesn't happen. Instead, there's thistorvin
guy in an awkward and most likely illegal situation.Both should be treated with a SMTP connection-stage rejection.