将原始邮件 ID 添加到后缀退回的邮件头中

将原始邮件 ID 添加到后缀退回的邮件头中

我正在运行票证支持系统利用邮牛电子邮件消息传递堆栈。

一切运行正常,除了由于邮箱问题等原因我们无法向票证作者发送电子邮件的情况。

在这种情况下,会发生以下情况:

  1. OS Ticket 尝试通过 Mailcow 的堆栈以常规方式发送电子邮件
  2. 电子邮件发送失败,Postfix 返回退回/“无法送达的邮件退回给发件人”电子邮件
  3. OS Ticket 就像 Mailer Daemon 创建了一张新票一样,但经常会丢失
  4. 我们的支持团队不知道电子邮件发送失败
  5. 我们的客户从未得到过帮助。

从 OSTicket 的角度来看,OSticket将尝试将退回的票与原始票进行匹配。。但是我的电子邮件方面的默认配置不包括所需的OSticket 期望的标头

我想修复这个问题,而且似乎添加额外的标题可能会帮助 OSTicket 意识到这是一个反弹。

我对 Postfix 还很陌生,所以我不知道如何做到这一点,但我很确定这是可行的。

有人能帮我弄清楚如何配置吗?谢谢!

我附上了一封退回邮件的完整原始源代码,虽然它被大量删改,但也许标题会有所帮助。

Return-Path: <>
Delivered-To: [REDACTED]
Received: from [REDACTED] ([[REDACTED]])
    by 847cc1941aed with LMTP
    id wPAfFiLbwmWYrwYAydh85g
    (envelope-from <>)
    for <[REDACTED]>; Wed, 07 Feb 2024 01:21:38 +0000
Received: by [REDACTED] (Postcow)
    id 5482521BF8E2; Wed,  7 Feb 2024 01:21:38 +0000 (UTC)
Date: Wed,  7 Feb 2024 01:21:38 +0000 (UTC)
From: MAILER-DAEMON@[REDACTED] (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: [REDACTED]
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
    boundary="CA4EC21BFE80.1707268898/[REDACTED]"
Message-Id: <20240207012138.5482521BF8E2@[REDACTED]>

This is a MIME-encapsulated message.

--CA4EC21BFE80.1707268898/[REDACTED]
Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host [REDACTED].

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<[REDACTED]>: connect to [REDACTED][[REDACTED]]:25:
    Connection timed out

--CA4EC21BFE80.1707268898/[REDACTED]
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; [REDACTED]
X-Postcow-Queue-ID: CA4EC21BFE80
X-Postcow-Sender: rfc822; [REDACTED]
Arrival-Date: Fri,  2 Feb 2024 01:10:13 +0000 (UTC)

Final-Recipient: rfc822; [REDACTED]
Original-Recipient: rfc822;[REDACTED]
Action: failed
Status: 4.4.1
Diagnostic-Code: X-Postcow; connect to [REDACTED]:25:
    Connection timed out

--CA4EC21BFE80.1707268898/[REDACTED]
Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <[REDACTED]>
Received: from [[REDACTED]] (localhost [[REDACTED]]) by [REDACTED] (Mailerdaemon) with ESMTPSA id CA4EC21BFE80;
    Fri,  2 Feb 2024 01:10:13 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=[REDACTED];
    s=dkim; t=1706836214;
    h=from:subject:date:message-id:to:cc:mime-version:content-type;
    bh=[REDACTED]
    b=[REDACTED]
Date: Fri, 02 Feb 2024 01:10:13 +0000
Message-ID: <BKAfB/m-40f2Z-AAAAAGINAACIBAAATe4OlSy5-[REDACTED]>
From: =?utf-8?Q?[REDACTED]?= <[REDACTED]>
Subject: =?UTF-8?Q?Re:=[REDACTED]?=
To: =?utf-8?Q?[REDACTED]?= [REDACTED]
Cc: =?utf-8?Q?[REDACTED]?= [REDACTED]
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="=_9875f05c0d2ad638ed6e39eb808b5ce5"
X-Last-TLS-Session-Version: TLSv1.3

This is a message in Mime Format.  If you see this, your mail reader does not support this format.

--=_9875f05c0d2ad638ed6e39eb808b5ce5
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
[REDACTED]
--=_9875f05c0d2ad638ed6e39eb808b5ce5--

--CA4EC21BFE80.1707268898/[REDACTED]--

答案1

标识字段RFC 5322, 3.6.4) In-Reply-ToReferences用于按主题对电子邮件回复进行排序。退回邮件又称递送状态通知Postfix DSN 支持基于RFC 3464其中没有提到这些标题。这与电子邮件回复的概念不同,尽管RFC 3834,3.1.6建议在自动回复(包括 DSN)中使用这些标头。我不知道有任何配置参数会改变 Postfix 中的这种行为。

正如 Postfix 所生成的RFC 3464基于格式良好的 DSN 消息,可以在票务系统中添加对它们的支持。


进一步了解 osTicketclass Mail_Parse {}表明它已经支持 RFC 3464 DSN:

  1. 如果Content-Type多部分消息的任意部分的 为message/delivery-status,则isBounceNotice()处理身体self::splitHeaders($body)查找标题Action: failed。如果发现,则该邮件被标记为退回。

  2. 在这种情况下parse($stream)获取标题getOriginalMessageHeaders()message/rfc822,它从或消息部分获取原始标头text/rfc822-headers。Postfix 的 DSN 在前者中包含原始消息及其标头。

    • references来自原始References标题和
    • in-reply-to取自Message-IDIn-Reply-To属于原始消息。

相关内容