5

In this blog post he suggests

echo '127.0.0.1    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.

Question

What is the recommended way to give sendmail a FQDN?

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

3 Answers 3

8

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
4

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.

2

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.

2
  • But isn't he suggesting what you recommend? Or am I misunderstanding something? Commented Nov 20, 2014 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
    Commented Nov 20, 2014 at 14:05

Not the answer you're looking for? Browse other questions tagged .