add Delivered-To header when locally delivering a DSN

so tools can pick it up and find the original "MAIL FROM", and take the encode
destination address or message id from its localpart.
This commit is contained in:
Mechiel Lukkien 2024-02-20 16:39:49 +01:00
parent 1c934f0103
commit 79da4faaa1
No known key found for this signature in database

View file

@ -162,7 +162,8 @@ func deliverDSN(ctx context.Context, log mlog.Log, m Msg, remoteMTA dsn.NameIP,
return
}
msgData = append([]byte("Return-Path: <"+dsnMsg.From.XString(m.SMTPUTF8)+">\r\n"), msgData...)
prefix := []byte("Return-Path: <" + dsnMsg.From.XString(m.SMTPUTF8) + ">\r\n" + "Delivered-To: " + m.Sender().XString(m.SMTPUTF8) + "\r\n")
msgData = append(prefix, msgData...)
mailbox := "Inbox"
senderAccount := m.SenderAccount