简体   繁体   English

记录sendmail和procmail的通用电子邮件标识符

[英]Logging a common email identifier for sendmail and procmail

In the processing of an in-bound email through sendmail and procmail, I am having trouble matching procmail log entries with sendmail's maillog entries. 在通过sendmail和procmail处理入站电子邮件时,我无法将procmail日志条目与sendmail的maillog条目进行匹配。 Sendmail posts the queue-id to the log. Sendmail将queue-id发布到日志中。

Is there a method of sendmail adding the mail queue's "Message-queue-id" to a custom header, and then capturing it in procmailrc for its use in posting it to procmail's log output entries? 是否有一种sendmail方法将邮件队列的“Message-queue-id”添加到自定义标头,然后在procmailrc中捕获它以便将其发布到procmail的日志输出条目?

For example, we just delete mail identified by spamassassin as Spam, but can't after the fact trace it back to a sendmail log entry due to lack of common identifier. 例如,我们只是将spamassassin识别的邮件删除为垃圾邮件,但由于缺少公共标识符,因此无法将其追溯到sendmail日志条目。

I am also interested to learn how to make Sendmail add a custom header that holds only the message queue ID. 我也有兴趣了解如何使Sendmail添加仅包含消息队列ID的自定义标头。 Until then I help myself by parsing the Received: header that is added which shows the ID after "id". 在那之前,我通过解析添加的Received:标题来帮助自己,该标题显示“id”之后的ID。 Here is a template for a Procmail recipe to extract the ID: 以下是用于提取ID的Procmail配方的模板:

:0
* ^Received: .*by myserver.example.net \(.*\) with [a-z]+ id \/[0-9a-z]+
{
   QID="$MATCH"
   LOG="Message queue ID = $QID ..."
}

You might need to adjust this the actual format of the Received header that your server (=myserver.example.net) adds. 您可能需要将此服务器(= myserver.example.net)添加的Received标头的实际格式调整为此值。 The \\/ is specific to Procmail's regex parser. \\/特定于Procmail的正则表达式解析器。 It does not match anything, it just splits the pattern and assigns whatever matches to its right to variable MATCH . 它不匹配任何东西,它只是拆分模式并将其右边的任何匹配分配给变量MATCH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM