I have a server set up running postfix and dovecot, accepting email locally for four domains (using virtual_mailbox_domains and virtual_mailbox_maps) and forwarding email to other locations for another six domains (using virtual_alias_domains and virtual_alias_maps).

I also have twenty or so email addresses being rejected (using check_recipient_access).

Two of the domains use catchall email addresses, the rest just accept for the required postmaster, webmaster, and abuse.

Somewhere in my configuration I have an error, because some of the mail for a local address is being delivered to the wrong local email account, and some of the mail that should be rejected is being delivered.

What I can't find is a utility that, given an email address, prints out where the email should be delivered, either locally or forwarded, based on my configuration files.

Does one exist?


postmap -q is the right tool to use to test maps, but has limitations:

  • It only searches for the key you give it, rather than trying keys in the order of precedence specified in access(5) or virtual(5).
  • It assumes you know which table to search.

To test end-to-end rewriting, use sendmail -bv, which generates and emails a report containing the address rewriting and routing details. This, of course, is part of the sendmail command-line interface, and so doesn't simulate rewriting that is explicitly performed by smtpd, such as FILTER or REDIRECT actions in access maps.

  • This did it. Sending email from my account sent me an email which had the original email address and the expanded email address and where it was delivered locally or forwarded. I was able to track down in my configuration values where they were overlapping and causing problems. – kitt Aug 24 '09 at 22:54

postmap is your friend!

Example usage:

postmap -q info@example.com hash:/etc/postfix/virtual
postmap -q info@example.com ldap:/etc/postfix/virtual.cf

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.