我的一些用户正在使用Gmail将邮件发送到我们的域名(邮件服务器托pipe在带有Postfix的CentOS 5机器上)。 有时候,但不是所有的时候,他们都会得到类似于以下的反弹:
---------- Forwarded message ---------- From: Mail Delivery Subsystem <[email protected]> Date: Mon, Aug 19, 2013 at 9:12 AM Subject: Delivery Status Notification (Failure) To: [email protected] Delivery to the following recipient failed permanently: [email protected] Technical details of permanent failure: Google tried to deliver your message, but it was rejected by the server for the recipient domain domain.com by mail.domain.com. [xxx.xxx.xxx.xxx]. The error that the other server returned was: 502 5.5.2 Error: command not recognized ----- Original message ----- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=...=; b=...== MIME-Version: 1.0 X-Received: by xxx.xxx.xxx.xxx with SMTP id ...; Mon, 19 Aug 2013 06:12:55 -0700 (PDT) Sender: [email protected] Received: by xxx.xxx.xxx.xxx with HTTP; Mon, 19 Aug 2013 06:12:55 -0700 (PDT) In-Reply-To: <[email protected]> References: <[email protected]> <[email protected]> <....gmail.com> <....gmail.com> Date: Mon, 19 Aug 2013 09:12:55 -0400 X-Google-Sender-Auth: ... Message-ID: <[email protected]> Subject: ... From: <[email protected]> To: <[email protected]> Content-Type: multipart/alternative; boundary=...
但奇怪的是,邮件仍然通过…
经过检查我的maillogs,我看到类似于:
Aug 19 9:12:36 domain postfix/smtpd[...]: connect from mail.google.com[xxx.xxx.xxx.xxx] Aug 19 9:12:37 domain postfix/smtpd[...]: XXXX: mail.google.com[xxx.xxx.xxx.xxx] Aug 19 9:12:37 domain postfix/smtpd[...]: warning: non-SMTP command from mail.google.com[xxx.xxx.xxx.xxx]: h=mime-version:sender:in-reply-to:references:date:message-id:subject Aug 19 9:12:37 domain postfix/smtpd[...]: disconnect from mail.google.com[xxx.xxx.xxx.xxx]
看起来好像我的邮件服务器正在将“h = mime”行解释为命令。
经过一番研究,我跟着这个线程:
http://serverfault.com/questions/379964/postfix-unknown-command/380248#380248
我加了
smtpd_command_filter = pcre:/etc/postfix/bogus_commands
参数添加到我的/etc/postfix/main.cf文件中,然后在bogus_commands文件中添加一些正则expression式来尝试replace任何以
h=mime
至
NOOP
但是,我试过的正则expression式似乎都没有工作。
我努力了:
/^.*h=mime.*$/\s NOOP preg_replace(^.*h=mime.*$, NOOP, ) /.*h=mime.*/ NOOP
任何人都可以帮我find正确的语法正则expression式,我需要这个工作? 我不是一个正统的专家。 我可能只是做一些简单的错误。 任何帮助你可以提供最赞赏。
在我的特殊情况下,事实certificate我正在使用不正确的postfix版本来尝试和实现smtpd_command_filter参数。 更新后的最新版本后,一切正常工作现在。