add Deliver-To header for delivered messages

for (experimental) rfc 9228
This commit is contained in:
Mechiel Lukkien 2023-08-09 10:20:45 +02:00
parent 20ebdae8ea
commit 0fc59af9a8
No known key found for this signature in database

View file

@ -2324,9 +2324,14 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
}
// ../rfc/5321:3204
// ../rfc/5321:3300
// Received-SPF header goes before Received. ../rfc/7208:2038
msgPrefix := []byte("Return-Path: <" + c.mailFrom.String() + ">\r\n" + authResults.Header() + receivedSPF.Header() + recvHdrFor(rcptAcc.rcptTo.String()))
msgPrefix := []byte(
"Delivered-To: " + rcptAcc.rcptTo.XString(c.smtputf8) + "\r\n" + // ../rfc/9228:274
"Return-Path: <" + c.mailFrom.String() + ">\r\n" + // ../rfc/5321:3300
authResults.Header() +
receivedSPF.Header() +
recvHdrFor(rcptAcc.rcptTo.String()),
)
if !msgWriter.HaveHeaders {
msgPrefix = append(msgPrefix, "\r\n"...)
}