How to debug Sendmail
The only problem is sending mail from PHP. I have installed sendmail.
I typed hostname to get my server hostname…
I then updated my /etc/hosts file…
127.0.0.1 localhost localhost.localdomain MY_HOSTNAME 127.0.1.1 ubuntu.members.linode.com ubuntu 127.0.1.1 MY_HOSTNAME
I run sendmailconfig and restart apache. Everything I read says this should work.
My PHP script seems to run without errors. (It worked on my previous server). I have checked my apache error log, php error log and my web app error log. No related errors.
Can anyone advice me on how to debug the problem?
echo "Subject: sendmail test" | sendmail -v
And got a response including…
050 550-5.7.1 [2a01:7e00::f03c:91ff:fef4:d22f] Our system has detected that this 050 550-5.7.1 message does not meet IPv6 sending guidelines regarding PTR records 050 550-5.7.1 and authentication. Please review 050 550-5.7.1 https://support.google.com/mail/?p=IPv6AuthError for more information 050 550 5.7.1 . x63si14327053wmf.220 - gsmtp
I followed the link
There is a lot of info but one point is …
> Keep valid reverse DNS records for the IP address(es) from which you send mail, pointing to your domain.
However, I haven't set up a domain name yet. I'm just using my local hosts file to point at the IP address of the server. So, I can't set up reverse dns. Could that be the problem?
This is a hacky minimum-effort setup. Your deliverability will be low. If you want a proper setup, you'd want a separate mailserver like iredmail, with DKIM and SPF configured, and joined to Microsoft JMRP, you'll need to verify your IP isn't on RBL anywhere and so on.
I haven't had a chance to test it yet but last night I realised that when you want to send mail you need a valid, resolving FQDN. As I'm just playing (and learning) with this server, I hadn't set one up yet. (I set the hostname but its not a FQDN). I'll do that and see what happens.
From your message, it sounds like Postfix has superseded sendmail? That makes sense because all the guides are for postfix! I will have a play with Postfix.
Regarding deliverability, the goal is simply to send contact messages through a web form, so they will just be going to one address and I can set up a rule to keep them out of spam. Hopefully that will be enough. And I'll look into SPF if needed.
Thanks for your help and advice.
Sendmail is a very powerful mail server. However, it is very old, extremely arcane in terms of configuration, and has a nasty legacy of security issues because most of it was written before developers were generally conscious of security. Postfix is a cleaner, safer and neater MTA. If I operated very large clusters of MTAs with enormous volumes of mail and needed every bit of performance and configurability and iron clad reliability, I would prefer qmail; in all other cases Postfix is the way to go for me (I run dozens of Postfix-based mailservers).
If your destination address is gmail, then yes, you would need at least rDNS and SPF. However, there is a better alternative: install a zero-MTA such as nullmailer and configure it to authenticate to gmail SMTP and send emails on behalf of your account. This works great on low volume of email and spares you the intricate configuration of a full mail server.
Think that is enough for my needs. Will have a play with Postfix when I have a spare evening.
Still not sure why you recommended disabling IPv6 at a machine level but guess that's a conversation for another day and a new thread.
Thanks for your help!
I guess you made changes in /etc/hosts to have a valid FQDN?
i will change to Postfix to later, but for now i need to install and configure sendmail, can you pls point out what you did to fix the problem,. I been running sendmailconfig with no luck, missing parameters i guess.