Troubleshooting sendmail on AIX

 

This document assumes that sendmail is already installed on your server

You will need to make some changes to the sendmail.cf file, this file is probably stored in /etc/mail

You may need to add values to the Dj (Domain name entry) and DS (Relay host entry)

Append the fully qualified domain of your local host to the Dj directive

Append the hostname (not the ip-address) of the mail server to the DS directive, with version 10 there seems to be a problem with putting the ip-address directly in the sendmail.cf file. Ensure that the mailserver hostname resolves correctly.

Also ensure that the fully qualified domain name of your local host is in /etc/hosts and that it is the first entry with any aliases following it.

To test the sendmail setup type the following

sendmail -bt -d0

You should get output similar to the following

Version AIX5.3/8.13.4

 Compiled with: DNSMAP LDAPMAP LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8
                MIME8TO7 NAMED_BIND NDBM NETINET NETUNIX NEWDB NIS NISPLUS
                PIPELINING SCANF USERDB USE_LDAP_INIT USE_TTYPATH XDEBUG

============ SYSTEM IDENTITY (after readcf) ============
      (short domain name) $w = myhostname
  (canonical domain name) $j = myhostname.sp.com
         (subdomain name) $m = sp.com
              (node name) $k = myhostname
========================================================

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter  address

The $j entry should match the Dj entry in the sendmail.cf

The $m entry should be correct if the fully qualified domain name was entered into /etc/hosts

In addition try the following command

sendmail -v "email-address"

Then type some text and on a new line insert a dot (period).

test

.

An output similiar to the following should be displayed

email-address... Connecting to mailhost. via relay...
220 .co.uk ESMTP Service (Lotus Domino Release 5.0.11) ready at Tue, 11 Sep 2007 16:44:42 +0100
>>> EHLO hostname.co.uk
250-.co.uk Hello hostname.co.uk ([195.211.102.24]), pleased to meet you
250-HELP
250-SIZE 52428800
250-8BITMIME
250 PIPELINING
>>> MAIL From: SIZE=5
250 me@host.co.uk... Sender OK
>>> RCPT To:
250 me@host.co.uk... Recipient OK
>>> DATA
354 Enter message, end with "." on a line by itself
>>> .
250 Message accepted for delivery
me@host.co.uk... Sent (Message accepted for delivery)
Closing connection to mailhost.
>>> QUIT
221 .co.uk SMTP Service closing transmission channel

If the output is something like

/dead.letter... Saved message in /dead.letter

Then there is a problem, in my case it was because the ip-address was in the sendmail.cf file instead of a resolvable name

If you suspect the mail relay host (the DS entry in sendmail.cf) then you can do the following to check it

telnet "mail relay host" 25

25 is the port smtp uses

You should get a response like the following, (your input is displayed in bold)

Trying...
Connected to mail-relay-host.
Escape character is '^]'.
220 mail-relay-host.com ESMTP Service (Lotus Domino Release 7.0.2FP1) ready at Tue, 11 Sep 2007 17:04:08 +0100
helo mail-relay-host
250 mail-relay-host Hello mail-relay-host ([10.252.56.9]), please to meet you
mail from: root@hostname.com
250 root@hostname.com... Sender OK
rcpt to: destination-email-address
250 destination-email-address... Recipient OK
data
354 Enter message, end with "." on a line by itself
subject: test
test
.
250 Message accepted for delivery
quit

The destination email address should receive your test email, if not there is a problem with the mail relay host and you should investigate there.

Testing SMTP authentication using telnet

Follow the example below starting with "telnet mailrelay 25" (be sure to change "mailrelay" to the hostname of your mail relay server. The characters and strings shown in bold are to be typed.

The username in this example is Y19ufnVjdC3kZXJ2ZXI= and the password is YdBunjNhdA==

Both these credentials are Base64 encrypted. You can use the tool located at http://ostermiller.org/calc/encode.html to encode your username and password to Base64.

telnet mailrelay 25

Trying...
Connected to mailrelay.
Escape character is '^]'.
220 example.co.uk VPOP3 ESMTP Server Ready

helo

250 example.co.uk VPOP3 SMTP Server - Hello <nohostname> (173.1.25.8), pleased to meet you

auth login

334 VXNlvm5hfWU6

Y19ufnVjdC3kZXJ2ZXI=

334 UGFkc3dvcpQ6

YdBunjNhdA==

235 Authentication Successful

mail from: root

250 2.1.0 <root@example.co.uk>... Sender ok

rcpt to: fred.blogs@examplemail.com

250 2.1.5 <fred.blogs@examplemail.com>... Recipient ok

data

354 Start Mail input, end with <CRLF>.<CRLF>

test1

.

250 2.0.0 OK

quit

221 2.0.0 example.co.uk VPOP3 Server Closing Connection
Connection closed.