From 79da4faaa1e7cdf944ef3d35a2fc0c2d97894ae7 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Tue, 20 Feb 2024 16:39:49 +0100 Subject: [PATCH] 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. --- queue/dsn.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/queue/dsn.go b/queue/dsn.go index c7fe323..dd2b6a2 100644 --- a/queue/dsn.go +++ b/queue/dsn.go @@ -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