Movie synopsis:
I'm managing just a few websites with VestaCP, each website has its own domain and so far it works good. The server is on Linode.
I have implemented a very simple contact form in one of the sites using php's mail()
:
$success = mail($EmailTo, $Subject, $Body, $headers);
For the $headers I've kept it simpler after trial and error: $headers = 'From: '. $EmailFrom;
The problem:
Now, of course, the e-mails I'm trying to send are not reaching the info box or my personal gmail box.
Testing:
So I tried testing through SSH. First I configured the mail log so I could see that line I posted above, I made sure (through
phpinfo()
) that PHP's using the intended sendmail bin (/usr/sbin/sendmail
). So it seemed it wasn't PHP/php.ini
's fault.Then I read here on serverfault.com to try the following short sendmail script (since turns out I don't know how to send e-mail just using the CLI):
That test seemed it had gone well (lots of data), and it's actually reaching my personal gmail box (spam folder of course):
#!/bin/sh
/usr/sbin/sendmail -i -v -- mybox@gmail.com <<
subject: testeando
asastest
END
But then I run the same script just changing to the info@goodsite.org and, besides from not reaching, the script says this:
LOG: MAIN
** info@goodsite.org: Unrouteable address
LOG: MAIN
<= <> R=1XnGAV-0004VJ-UP U=Debian-exim P=local S=1113
LOG: MAIN
Completed
delivering 1XnGAV-0004VN-VO
LOG: MAIN
** root@linodecentral: Unrouteable address
LOG: MAIN
Frozen (delivery error message)
Now I'm stuck. I don't know how gmail is "routable" but the perfectly working google-MX domain is not. Plus I don't know if my hostname (linodecentral) has something to do with it?
Summing up the results:
- the form can reach neither box.
- the sendmail bash script can only reach my personal box (and its from e-mail sucks).
EDIT:
This is what the exim4's mainlog says when trying info@goodsite:
2014-11-08 23:23:20 1XnEPg-0001bg-Hb <= pvc@LinodeCentral U=pvc P=local S=495
2014-11-08 23:23:20 1XnEPg-0001bg-Hb ** info@goodsite.org: Unrouteable address
2014-11-08 23:23:20 1XnEPg-0001bk-IY <= <> R=1XnEPg-0001bg-Hb U=Debian-exim P=local S=1287
2014-11-08 23:23:20 1XnEPg-0001bg-Hb Completed
2014-11-08 23:23:20 1XnEPg-0001bk-IY ** pvc@linodecentral: Unrouteable address
2014-11-08 23:23:20 1XnEPg-0001bk-IY Frozen (delivery error message)
And this when trying my personal inbox (which sends correctly to):
2014-11-09 01:02:38 1XnFxm-00047Z-3L <= root@LinodeCentral U=root P=local S=320
2014-11-09 01:02:38 1XnFxm-00047Z-3L => mybox@gmail.com R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [2a00:1450:400c:c01::1b] X=TLS1.2:RSA_ARCFOUR_SHA1:128 C="250 2.0.0 OK 1415491358 ey11si10238321wid.16 - gsmtp"
2014-11-09 01:02:38 1XnFxm-00047Z-3L Completed
I don't know why it's using root to send to my personal inbox and pvc (the user owner of the website folder and whatnot) for the other address.
PS: obv "goodiste.org" is just a place holder for the real domain.