Setting up FQDN in sendmail

15,776

Solution 1

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

Solution 2

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.

Solution 3

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.

Share:
15,776

Related videos on Youtube

Jasmine Lognnes
Author by

Jasmine Lognnes

Updated on September 18, 2022

Comments

  • Jasmine Lognnes
    Jasmine Lognnes over 1 year

    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?

    • MadHatter
      MadHatter over 9 years
      Is this server sending mail to, or receiving it from, the internet?
    • Jasmine Lognnes
      Jasmine Lognnes over 9 years
      It is only sending.
  • Jasmine Lognnes
    Jasmine Lognnes over 9 years
    But isn't he suggesting what you recommend? Or am I misunderstanding something?
  • drookie
    drookie over 9 years
    He is not. Describing local IP addreses in /etc/hosts and aliasing all the domain names to localhost are totally opposing ways.