Configure Sendmail without DNS

This guide is using Sendmail version 8.13.8 on Redhat Enterprise Linux (RHEL5.2). The smart host is Microsoft Exchange server (running ESMTP service, a.k.a. Extended SMTP or Enhanced SMTP), with IP address 192.168.35.1 and registered as exch01.walkernews.net on official DNS server (though it is not used by Sendmail).

  1. Edit /etc/hosts to add IP-DNS mapping for the smart host. With /etc/hosts file, you can use a different name to refer the smart host IP. For example:
    192.168.35.1   esmtp   esmtp.walkernews.net
    
  2. Create /etc/mail/service.switch, which contains only this line:
    hosts files
    
  3. Edit /etc/mail/sendmail.cf:
    • Locate “DS” and replace it to become (replace the host name with the one you have defined in /etc/hosts file):
      DSesmtp.walkernews.net
      
    • Locate “ServiceSwitchFile” and change it to become as follow (or just add in this following line if there is no ServiceSwitchFile in sendmail.cf yet):
      O ServiceSwitchFile=/etc/mail/service.switch
      
  4. Restart Sendmail service to verify sendmail.cf configuration
    service sendmail restart
    

Now, try to send a test email, using Sendmail to relay to Microsoft Exchange server:

mail -s "Test email" walker@walkernews.net </dev/null

On Microsoft Outlook that connect to Exchange server, just press F9 to synchronize Inbox immediately.

If the Exchange server allows email relay from this particular Linux SMTP server, the test email should be delivered. Otherwise, try to use telnet to connect SMTP server for troubleshooting.

5/ Test Sendmail:

5.a/ Compose text file with the following content:

#vi tmp.txt

To: mywife@email.com

CC: abc@example.com

Subject: Test mail

From: my@email.com

And here goes the email body, test test test

 

5.b/ Then execute the command below:

#sendmail -vt < tmp.txt