Can sendmail be used without DNS?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux
  • sendmail

Issue

  • How to use sendmail without DNS?
  • Can I setup sendmail to forward outgoing mails to a different system (smarthost), without having DNS available?

Resolution

There are a number of steps required to successfully use sendmail when there is limited or no DNS.

  1. Setting a SMARTHOST

    • Ensure the required host is resolvable, either by /etc/hosts or DNS, or alternatively specify an IP address.

    • Use line in /etc/mail/sendmail.mc that resembles define(`SMART_HOST',`name.of.smart.host')dnl

    • For more information, please see: How to configure a Sendmail Smart Host

  2. Since the system implicitly have limited resolving capabilities, accept email for unknown domains

    • Use line in /etc/mail/sendmail.mc of the form FEATURE(accept_unresolvable_domains)dnl
  3. Ensure that the ServiceSwitchFile (by default at /etc/mail/service.switch) has content similar to:

    aliases files
    hosts files
    
  4. Setting the submission agent to ignore DNS

    • Use line in /etc/mail/submit.mc of the form define(`confDIRECT_SUBMISSION_MODIFIERS',`C')

    • Use line in /etc/mail/submit.mc of the form FEATURE(accept_unresolvable_domains)dnl

Having completed the above changes remake the submit.cf & sendmail.cf by typing make in /etc/mail

The daemon may also need to be restarted with the command:

# service sendmail restart

Diagnostic Steps

  • Various logfiles in directory /var/log can help debugging mail issues.
  • To send testmails commands like the following can be used:
# echo "content" | mailx -s "subject" recipient@receiverdomain.example.org
SBR
Components
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.