Hello, list!

My setup is this: I use postfix to relay mail to external SMTP servers (of ISP, employer etc.) according to sender_dependent_relayhost_maps. This works with multiple "From: " identities set by various MUAs. Local delivery to dovecot is also set up for mail from cron etc. All this works fine.

postconf -n:
alias_database = hash:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
compatibility_level = 2
inet_protocols = ipv4
local_recipient_maps =
mailbox_command = /usr/libexec/dovecot/dovecot-lda
mydestination = <redacted>
myhostname = <redacted>
mynetworks_style = host
sender_dependent_relayhost_maps = hash:/etc/auth/postfix-relayhosts
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/auth/postfix-logindata
smtp_sasl_security_options = noanonymous
smtp_sender_dependent_authentication = yes
smtp_tls_mandatory_ciphers = high
smtp_tls_security_level = encrypt

master.cf (head):
127.0.0.1:25      inet  n       -       n       -       -       smtpd
  -o syslog_name=postfix/localhost

My problem is: Sometimes, a client may provide a "From: " identity that's not represented in sender_dependent_relayhost_maps, because of a typo, wrong setting or something. postfix then does not relay the mail, but attempts to deliver it directly to the receiver domain's MX. This gets me in all sorts of trouble, because without SMTP relay, I'm just a loser on a dynamic IP. Receiver MX servers reject my mail, block my IP and so on.

Here's two alternate ideas of how I would like postfix to behave instead:

1. Postfix should reject all mail that doesn't have a "From: " identity associated with a relayhost in sender_dependent_relayhost_maps.

2. Postfix should *only* relay through one of the hosts in sender_dependent_relayhost_maps (or deliver locally), and *never* try to deliver directly to some external domain's MX.

How could I achieve this behavior?

Thanks for your time!
Michael

Reply via email to