We do not check it currently because we are not supposed to send bounce messages, but it looks like it's wrong, bounce messages are still sent in case some delivery is to over quota user: chatmail/relay#873
This makes sense in a hindsight: when chatmail relay gets incoming message over SMTP and it cannot be delivered to one of the recipients, we cannot reject it immediately because SMTP returns only one error for the whole message. It is then delivered over LMTP to Dovecot, which returns success for some recipients and error for others. Postfix then generates bounce message with delivery failure, but the message as a whole is accepted over SMTP.
Since we are sending messages to MAIL FROM: address in some cases, we need to check for incoming messages that the address is the same as the From: header address. If not, I would not reject the message because some servers may send different MAIL FROM: for reasons like using SRS, but replace MAIL FROM: with <> so no bounce is sent.
We do not check it currently because we are not supposed to send bounce messages, but it looks like it's wrong, bounce messages are still sent in case some delivery is to over quota user: chatmail/relay#873
This makes sense in a hindsight: when chatmail relay gets incoming message over SMTP and it cannot be delivered to one of the recipients, we cannot reject it immediately because SMTP returns only one error for the whole message. It is then delivered over LMTP to Dovecot, which returns success for some recipients and error for others. Postfix then generates bounce message with delivery failure, but the message as a whole is accepted over SMTP.
Since we are sending messages to
MAIL FROM:address in some cases, we need to check for incoming messages that the address is the same as theFrom:header address. If not, I would not reject the message because some servers may send differentMAIL FROM:for reasons like using SRS, but replaceMAIL FROM:with<>so no bounce is sent.