In my postfix main.cf I have:
smtpd_recipient_restrictions = reject_unauth_destination, check_recipient_access regexp:/etc/postfix/access.me
…
virtual_alias_maps = hash:/etc/postfix/virtual
…
In my virtual file I have:
a@mydomain.com xxxx@gmail.com
na@mydomain.com xxxx@gmail.com
@mydomain.com xxxx@gmail.com
In my access.me file I have:
/^abc/ OK
/a@mydomain.com/ OK
/na@mydomain.com/ REJECT failed test
/@mydomain.com/ REJECT failed test contact us@mydomain.com
With this I have successfully failed (!) to send to na@mydomain.com so I know access.me is being read correctly by postfix.
If I send to xyz@mydomain.com it fails (correctly) rejected by Line 4 of access.me
However if I try to mail abc123@mydomain.com it fails with "User unknown in virtual alias table" which shows that it is accepted by line 1 of access.me, but I need this email to succeed and get through.
So nearly there but I must be misunderstanding postfix logic…
Tim
Best Answer
Having tested it again to provide more information I found that it did actually work (for the first time) so either the virtual file was not the latest version or there was a delay in propagation.
This configuration was designed so that customers could send emails to us where the email address itself was generated from data (ex: location and language of user), since coupled with the sender address the customer need not input anything apart from their comments.
So this does seem to be a valid way to enable customised email addresses to get through postfix while rejecting randomised email addresses / spam.
Tim