0

I recently purchased a cloud VPS service - CENTOS 7.

I've configured my website everything on that front is fine and well, however I noticed email isn't always being received.

I believe the emails are being sent out using PHP mail function - which defaults to using sendmail.

In the /var/log/maillog I can see the following:

Sep 10 21:59:01 mail sendmail[2615]: u8AKx0ZK002614: to=root, ctladdr=<apache@mywebsitedomain.co.uk> (48/48), delay=00:00:01, xdelay=00:00:01, mailer=local, pri=41036, dsn=2.0.0, stat=Sent
Sep 10 22:03:16 mail sendmail[2656]: u8AL3G7U002656: from=apache, size=10690, class=0, nrcpts=1, msgid=<015be58bc4d8990a25ba7895538ea4db@mywebsitedomain.co.uk>, relay=apache@localhost
Sep 10 22:03:16 mail sendmail[2657]: u8AL3G7h002657: from=<apache@mywebsitedomain.co.uk>, size=10783, class=0, nrcpts=1, msgid=<015be58bc4d8990a25ba7895538ea4db@mywebsitedomain.co.uk>, proto=ESMTP, daemon=MTA, relay=mywebsitedomain.co.uk [127.0.0.1]
Sep 10 22:03:16 mail sendmail[2656]: u8AL3G7U002656: to=info@mywebsitedomain.co.uk, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=40690, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u8AL3G7h002657 Message accepted for delivery)
Sep 10 22:03:16 mail sendmail[2658]: u8AL3G7h002657: to=root, ctladdr=<apache@mywebsitedomain.co.uk> (48/48), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=40996, dsn=2.0.0, stat=Sent
Sep 10 22:03:16 mail sendmail[2660]: u8AL3GQp002660: from=apache, size=10914, class=0, nrcpts=1, msgid=<d148a9c441d201d8a24c64c517050ede@mywebsitedomain.co.uk>, relay=apache@localhost
Sep 10 22:03:16 mail sendmail[2661]: u8AL3GB4002661: from=<apache@mywebsitedomain.co.uk>, size=11007, class=0, nrcpts=1, msgid=<d148a9c441d201d8a24c64c517050ede@mywebsitedomain.co.uk>, proto=ESMTP, daemon=MTA, relay=mywebsitedomain.co.uk [127.0.0.1]
Sep 10 22:03:16 mail sendmail[2660]: u8AL3GQp002660: to=mypersonalemail@googlemail.com, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=40914, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u8AL3GB4002661 Message accepted for delivery)
Sep 10 22:03:16 mail sendmail[2663]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Sep 10 22:03:17 mail sendmail[2663]: u8AL3GB4002661: to=<mypersonalemail@googlemail.com>, ctladdr=<apache@mywebsitedomain.co.uk> (48/48), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=131007, relay=gmail-smtp-in.l.google.com. [64.233.166.26], dsn=2.0.0, stat=Sent (OK 1473541397 f23si8646501wmh.115 - gsmtp)

The email is successfully received on my personal Google email address, but the other order confirmation isn't received on the business email side (which is hosted by Google Apps).

I can see that in the email source (using a spam tester website).

The following looks wrong:

envelope-from=apache@mywebsitedomain.co.uk;
Return-Path: apache@mywebsitedomain.co.uk

Could the above be the reason I am not receiving emails or am I missing the plot here?

Edit

I must also add, the website has not had its DNS record updated yet to point to the new server. I am currently testing using a hosts file and have updated the SPF record to allow the new server to send emails by using the include ip4 markup.

2 Answers2

0

Have you set up stuff like DKIM, SPF, DMARC and so on?

DKIM: http://www.gettingemaildelivered.com/dkim-explained-how-to-set-up-and-use-domainkeys-identified-mail-effectively

SPF: https://mediatemple.net/community/products/dv/204404314/how-can-i-create-an-spf-record-for-my-domain

DMARC: dmarc.org

rocket_doge_
  • 171
  • 5
  • Hi there, yes I have. I setup a DKIM yesterday although the mail tester claims the email is not signed for some reason. I suspect this may be because the dkim uses the subdomain: google._domainkey? The SPF is recognised and that is authenticated correctly. – user1942793 Sep 11 '16 at 08:26
  • Can you check the mail headers if the DKIM entry is present? – rocket_doge_ Sep 11 '16 at 08:32
  • should look something like that:DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fuchstim.de; s=mail; t=1473582444; bh=iWabYn/O2aIi07LXrNW6Iv2uHhlWKGl7pa7DqDYv6Ng=; h=Date:Subject:From:To:From; b=b6QL5lQ33mqoTZsZHeMfUZto/Q6FCcab48F5j+NSux67aBRorFQc6WEvkswTkJTzU E52GkeLRtxARXkh9w5Yv7MelWb95j28MggEroA7vSrKh1XdatX9WYQ8KTmgKzFaodp d7dq7FCVn6AC5BJRd1yVQVxaJXq9yA+ck+ – rocket_doge_ Sep 11 '16 at 08:32
  • I think I'm wrong, I didn't set it up on my server. I set DKIM up on Google rather than my end. So through Google Apps it produced a DKIM which I simply put on my DNS TXT record. I am guessing this is not enough? There is no DKIM entry in the header. – user1942793 Sep 11 '16 at 08:33
  • You have to set up DKIM on the mail server itself so it can add the DKIM entry to every email sent from the server – rocket_doge_ Sep 11 '16 at 08:34
  • Also I heard using Postfix instead of Sendmail fixes a lot of issues. I've installed it but it still uses Sendmail and I'm unsure how to switch. Should I open another thread for this or could you potentially point me in the right direction? I've tried googling it but I can't find something that doesn't go over my head. Postfix should also be easier to use DKIMs with apparently? – user1942793 Sep 11 '16 at 08:36
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/45228/discussion-between-user1942793-and-rocket-doge). – user1942793 Sep 11 '16 at 08:38
  • Yes I'm still here. Join the room :) – user1942793 Sep 11 '16 at 13:11
0

This was simply resolved by installing Postfix and switching to it (CREDIT TO rocket_doge_) for helping me do this.