Redhat – Does the server hostname need to match the domain name of the email address you are sending from? Does the hostname need to be verifiable with DNS

hostnameredhatsendmailspam

I am trying to diagnose why email won't send from a new RHEL v5.8 server. Sendmail is up and running, but everything is stuck in the queue (confirmed with mailq) with connection timed out errors.

If I have the hostname of the server to:

natulwebserver01.bto.com

But try to send emails with PHP and set the 'from' email address to:

no-reply@dataportal.com

…this would cause the destination mail servers to block the emails right?

If so, does that mean the email address I set as a 'from' address in the PHP mail() function would have to match the server hostname exactly? For example:

no-reply@natulwebserver01.bto.com

I have tried that and it doesn't work, but I want to ask just to confirm in theory.

Also – and maybe this is the real cause – does the hostname need to resolve to the IP address of the server in the destination mailserver's DNS before it will accept emails from it?

For example:

natulwebserver01.bto.com

…is an internally meaningful hostname, but it is not a publicly registered domain name. i.e. if you ping natulwebserver01.bto.com it will not return the IP address of the server.

Does it make sense that the destination mailservers would block email from my server as it is reporting a hostname that cannot be verified with DNS?

*I have modified the actual hostnames/domains involved for the purposes of this question.

Best Answer

The domain in the 'From' address need not be the same as the hostname of the smtp server, but the hostname should be publicly registered and match reverse DNS of the IP on which sendmail is running.