if an smtp-submitted message has a return-path header, only fail in pedantic mode

some software sends messages with return-path header.

for issue #103 by Halyul, thanks for reporting!
This commit is contained in:
Mechiel Lukkien 2023-12-20 21:01:47 +01:00
parent d73bda7511
commit 57fc37af22
No known key found for this signature in database

View file

@ -1819,9 +1819,9 @@ func (c *conn) submit(ctx context.Context, recvHdrFor func(string) string, msgWr
// Outgoing messages should not have a Return-Path header. The final receiving mail
// server will add it.
// ../rfc/5321:3233
if header.Values("Return-Path") != nil {
if mox.Pedantic && header.Values("Return-Path") != nil {
metricSubmission.WithLabelValues("badheader").Inc()
xsmtpUserErrorf(smtp.C550MailboxUnavail, smtp.SeMsg6Other0, "message must not have Return-Path header")
xsmtpUserErrorf(smtp.C550MailboxUnavail, smtp.SeMsg6Other0, "message should not have Return-Path header")
}
// Add Message-Id header if missing.