In this blog post he suggests

echo '    localhost EXAMPLE.my_domain localhost.localdomain EXAMPLE' >> /etc/hosts

but ends the post with

But this is a less desirable approach since it may have some side effects.

In this questions there isn't a definitive answer on the solution.


What is the recommended way to give sendmail a FQDN?

closed as off-topic by Sven, Jenny D, HBruijn, Katherine Villyard, Ward Nov 21 '14 at 3:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Sven, Jenny D, HBruijn, Katherine Villyard, Ward
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Is this server sending mail to, or receiving it from, the internet? – MadHatter Nov 20 '14 at 13:28
  • It is only sending. – Jasmine Lognnes Nov 20 '14 at 13:58

For sendmail, I do two things:

  • Make sure my /etc/hosts file follows the standard documented here.
  • If I need to present a specific outgoing server name, I define confDOMAIN_NAME in sendmail.mc to reflect the right name:
define(`confDOMAIN_NAME', `mail.juicybanana.com')dnl

You say the mail server is going to be sending to the internet. That means it's going to connect to public mail servers, and the first thing it will do (as part of the SMTP HELO) is declare its own FQDN.

If you use a false or non-resolving FQDN here, a lot of mail servers are going to refuse to talk to you any further, or will use that as a strong indicator for spam even if they accept your email. You are strongly advised to register a domain name and declare a valid hostname under that, to use in the sendmail config. If you already have a domain name, you can declare a new subdomain, and a hostname under that for this server.

The only mail servers that can get away with nonexistent FQDNs are those which are purely internal, and even then it's often so painful that I advise people to use a valid FQDN.


The recommended way is to fill the /etc/hosts with records, one for each ip address of the host, with a configured hostname of this host (with the appropriate command), so sendmail won't need to query the DNS. "He", whoever this is, is wrong. He is showing you a perfect way to shoot your own leg.

  • But isn't he suggesting what you recommend? Or am I misunderstanding something? – Jasmine Lognnes Nov 20 '14 at 14:00
  • 1
    He is not. Describing local IP addreses in /etc/hosts and aliasing all the domain names to localhost are totally opposing ways. – drookie Nov 20 '14 at 14:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.