1
I have a CentOS server that hosts a public website containing a contact form. That contact form calls a php script that sends a mail.
If I send a mail to certain domains I get errors like this :
<someone@strictdomain.com>: host spool.mail.gandi.net[2001:4b98:c:521::6] said: 550
5.1.8 <apache@CentOS-63-64-minimal.localdomain>: Sender address rejected:
Domain not found (in reply to RCPT TO command)
The website is running on Apache as the apache user, so the PHP script sends the mail on that users behalf. The fact that it uses CentOS-63-64-minimal.localdomain
is the root-cause I guess. (the receiving end, gandi.net in this case, does a check and rejects the message). Other domains are more lenient, but still I want to fix this configuration issue.
Assuming that the public website is accessed using "mypublicsite.com" and the DNS zone contains the following records
- A and CNAME records to have it point to the CentOS server
- Proper MX records that point to the DNS registrar (mypublicsite.com is using the registrars mail package and that is working fine).
The hosts file
on the CentOS server contains CentOS-63-64-minimal
.
How can I configure the server and / or apache that mails are sent out properly. I'm assuming that somewhere I would need to configure the mail system (?)
to use mypublicsite.com
instead of using CentOS-63-64-minimal.localdomain
. Can this be done on the server or is this handled by a DNS config ?
I have no plans to do any kind of mail hosting on this CentOS server. I simply want to be able to send mails from that server to any domain through the contact form on the site that I'm hosting.
Is that the case ? If I change my hostname to a valid FQDN (some internal server name like server1.mycompany.com, available through DNS) the mailserver at ghandi accepts the message fine. Would that be a valid scenario ? – ddewaele – 2014-03-22T12:07:22.203
As long as your Gandi account is the Sender and you're using the submission port, that should be fine. – milli – 2014-03-22T21:41:50.527