Sendmail适当的configuration

我有一个小型服务器(Ubuntu 14.04)多个网站。 其中一个网站需要通过各种操作(注册,密码恢复等)向用户发送电子邮件。 我安装了sendmail,我可以从PHP脚本发送邮件

我configuration了SFP DNS条目。 我服务器的主机名是“橡皮”。 我的/ etc / hosts文件包含

127.0.0.1 localhost localhost.localdomain rubber public.ip.address rubber 

使用此configuration,发送电子邮件需要很长时间(大约20秒)。 另外,sendmail日志(/var/log/mail.log)显示如下一行:

 Sep 24 17:28:52 server sendmail[19842]: s8OFSLUd019842: to=<[email protected]>, delay=00:00:15, xdelay=00:00:15, mailer=relay, pri=30370, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (s8OFSbcl019844 Message accepted for delivery) 

收到的邮件标题看起来像这样(我已经改变了真实的地址):

 Delivered-To: [email protected] Received: by 10.112.136.195 with SMTP id qc3csp517582lbb; Wed, 24 Sep 2014 08:20:55 -0700 (PDT) X-Received: by 10.180.99.195 with SMTP id es3mr12425233wib.67.1411572055732; Wed, 24 Sep 2014 08:20:55 -0700 (PDT) Return-Path: <[email protected]> Received: from localhost.localdomain ([2022:4ff0:51:500::16e]) by mx.google.com with ESMTPS id el1si7235041wid.69.2014.08.22.08.20.55 for <[email protected]> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Sep 2014 08:20:55 -0700 (PDT) Received-SPF: pass (google.com: domain of [email protected] designates 2022:4ff0:51:500::16e as permitted sender) client-ip=2022:4ff0:51:500::16e; Authentication-Results: mx.google.com; spf=pass (google.com: domain of [email protected] designates 2022:4ff0:51:500::16e as permitted sender) [email protected] Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id s8OFKPU7019505 for <[email protected]>; Wed, 22 Sep 2014 17:20:40 +0200 Received: from website-test.com (www-data@localhost) by localhost.localdomain (8.14.4/8.14.4/Submit) with SMTP id s8OFKAOG019503 for <[email protected]>; Wed, 22 Sep 2014 17:20:25 +0200 X-Authentication-Warning: localhost.localdomain: www-data owned process doing -bs Message-ID: <[email protected]> Date: Wed, 22 Sep 2014 17:20:09 +0200 Subject: Test email From: "Website.com" <[email protected]> To: [email protected] MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 

我的问题是:

  1. 如何让sendmail服务器更快地发送邮件? 什么要花这么长时间?
  2. 我怎样才能摆脱像localhost.localdomain和本地服务器的用户名这些“个人头”?

每个连接延迟是由于sendmail希望查找自己的完全限定的域名(FQDN),而这些域名通过尝试反向parsing其外部IP地址而失败。 你还没有给它一个FQDN,所以它试图通过localhost.localdomain来获取它,它从hosts文件的localhost条目中收集到(你可以在你的一些Received: from行中看到证据)。 如果你给sendmail一个FQDN,把一个FQDN作为你hosts文件的external-ip-address行的第一个入口,它应该加速所有的操作。

至于Received: from行中删除一些Received: from它们被添加为一个RFC要求每次消息从一个控制领域传递到另一个。 你是否有一个很好的商业理由想要摆脱它们? 因为如果你不这样做 – 通常情况下,即使你这么做,把它们混淆也是一个非常糟糕的主意。