I have a small server (Ubuntu 14.04) for multiple websites. One of these websites needs to send emails to the user on various actions (registration, password recovery, etc.). I have sendmail installed and I'm able to send mail from PHP scripts.
I have configured a SFP DNS entry. I server's hostname is "rubber". My /etc/hosts file contains
127.0.0.1 localhost localhost.localdomain rubber
public.ip.address rubber
With this configuration, sending email takes very long (about 20 seconds). Also, the sendmail log (/var/log/mail.log) show a line like this:
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)
The received mail headers look like this (I've changed real addresses):
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
My questions are:
- How can I make the sendmail server to send the emails faster? What's taking so long?
- How can I get rid of those "personal headers" like the localhost.localdomain and the local server username?
sendmail
really, really likes to know it's FQDN, and from the above, all it can find islocalhost.localdomain
, which doesn't work very well. Have you tried putting an FQDN in the hosts file, preferably first on the line with the public ip address?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
I don't want it to send the local server user that initiated the mail sending.