0

I'm currently attempting to receive and deliver all emails to *@example.com to me@example.com. However I'd also like to reject all mail to bad@mydomain.com. I essentially need a wildcard where I can define one (or more) exceptions to the wildcard.

I've currently configured my wildcard via a virtual_alias_maps = hash:/etc/postfix/virtual directive which works with the following configuration:

@example.com me
me@example.com  me

I'd now like to reject all email going to bad@example.com, rather than delivering it to my or any other mailbox. I can't seem to find information on how to reject based on specific addresses in a wildcard.

How do I stop emails from being accepted due to matching the wildcard in the virtual_alias_maps?

  • I think there exists a special target to explicitly return a failure for a lookup. You could achieve rejecting mails to bad@example.com with a line like “bad@examble.com FAIL”. Unfortunately, I can’t find this anymore in Postfix’s online documentation. – user2233709 Mar 15 '17 at 19:35
2

virtual appears to just be mappings; to block sending to a particular email I'd probably try an access(5) entry tied to the recipient checks:

smtpd_recipient_restrictions =
  ...
  check_recipient_access hash:/etc/postfix/rctpaccess
  ...

And then something like:

cd /etc/postfix
echo "bad@example.com REJECT" >> rctpaccess
postmap rctpaccess

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.