+++
title = "block mails for unknown users"
date = "2014-01-16T09:01:01+00:00"
author = "Gibheer"
draft = false
+++

Postfix' policy system is a bit confusing. There are so many knobs to avoid
receiving mails which do not belong to any account on the system and most of
them check multiple things at once, which makes building restrictions a bit of
a gamble.

After I finally enabled the security reports in freebsd the amount of mails in
the mailqueue hit me. After some further investigation I found even error
messages of dspam, having trouble to rate spam for receivers which were not
even in the system.

To fix it, I read into the postfix documentation again, build new and hopefully
better restrictions. The result was even more spam getting through.
After a day went by and my head was relaxed I read the documentation again and
found the following in the
[postfix manual](http://www.postfix.org/VIRTUAL_README.html#in_virtual_other)

> The `virtual_mailbox_maps` parameter specifies the lookup table with all valid
> recipient addresses. The lookup result value is ignored by Postfix.

So instead of one of the many restrictions a completely unrelated parameter is
responsible for blocking mails for unknown users. Another parameter related is
[`smtpd_reject_unlisted_recipient`](http://www.postfix.org/postconf.5.html#smtpd_reject_unlisted_recipient).
This is the only other place I could find, which listed `virtual_mailbox_maps`
and I only found it when looking for links for this blog entry.

So if you ever have problems with receiving mails for unknown users, check
`smtpd_reject_unlistef_recipient` and `virtual_mailbox_maps`.
