Postfix – Block email from non-existent local addresses

emailpostfixsmtpspam

My question is very similar to this one, but for postfix.

We keep getting emails from addresses like "accounting@example.com" delivered to our actual "@example.com" addresses. From my google research, I understand it might not be practical to verify the email originated from our IP or VPN (Although this would be ideal, so if you can think of a way to do this, let me know), but in most of these cases the sender address (ex. "accounting") is not a valid account.

I imagine there must be a way to make sure that a local account exists before delivering the message.

Best Answer

You'll want to add reject_unlisted_sender to your smtpd_sender_restrictions.

Without a little planning this will also reject mail from root@hostname.example.com as well, so keep that in mind.


smtpd_reject_unlisted_sender
Request that the Postfix SMTP server rejects mail from unknown sender addresses. This can slow down an explosion of forged mail from worms or viruses.

An address is always considered "known" when it matches a virtual(5) alias or a canonical(5) mapping.

The sender domain matches $mydestination, $inet_interfaces or $proxy_interfaces, but the sender is not listed in $local_recipient_maps, and $local_recipient_maps is not null.

  • The sender domain matches $virtual_alias_domains but the sender is not listed in $virtual_alias_maps.
  • The sender domain matches $virtual_mailbox_domains but the sender is not listed in $virtual_mailbox_maps, and $virtual_mailbox_maps is not null.
  • The sender domain matches $relay_domains but the sender is not listed in $relay_recipient_maps, and $relay_recipient_maps is not null.

    This feature is available in Postfix 2.1 and later.

Related Topic