San Francisco

dave spink toolset




We needed reliable mail delivery to support the core applications installed on Unix, the obvious choice for us was Sendmail.


Sendmail Local Delivery
A message from serverA "/usr/lib/sendmail -v" will first be sent to the local sendmail daemon running on serverA. The local sendmail daemon establishes a SMTP connection to serverB. If the user "spi0004" exists on serverB the sendmail server accepts the message, else an error "user unknown" is returned to serverA. The /etc/mail/aliases file on serverB is checked for aliases entries, for example, the alias entry of "spi0004:spi0004," results in the email being forwarded onto mail servers. If no aliases exists the server delivers mail into the local mailbox of user "spi0004" on serverB. Mail may then be read by the user using pop3 or some other service.

Sendmail as a Forwarder
Our sendmail servers are configured to deliver mail on behalf of other servers in our a domain - a termed called "forwarder". The business application establish a SMTP connection to our sendmail server. The sendmail service receives and queues the message(s). The daemons work the queue by extracting the message header and performing mail record lookups via DNS in order to determine the recipients mail server. Once the IP address of the recipients mail server is known the sendmail service establishes a connection and delivers the message on behalf of the applicaion.


Understanding Mail Logs
The following log file extract shows a message accepted and delivered by sendmail. The first entry is saying a user "remown" on server c2pr0001 is asking sendmail on server d1pr0004 to deliver a message. The sendmail process accepts the messages, queues the message, and then checks DNS for a MX record i.e. the mail server that can deliver the message to "Monique Sullivan". The status of "Sent" indicates the mail has been delivered to "". The "Queued mail for delivery" in this example is the response from the "" mail server, some mail server simply respond "Accepted".

Aug 29 20:27:11 d1pr0004 sendmail[26176]: [ID 801593] k7TKRB926176: 
from=<>, size=1938, class=0, nrcpts=1, 
msgid=<> proto=ESMTP, daemon=MTA, relay=[]

Aug 29 20:27:11 d1pr0004 sendmail[26178]: [ID 801593] k7TKRB926176:
to=<>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp,
pri=121938, [], dsn=2.0.0, 
stat=Sent (<> Queued mail for delivery)

The following extract show the mail server "bdp" refuses connection from our sendmail server.

Aug 29 14:44:38 d1pr0004 sendmail[18374]: [ID 801593] k7OEWm909422:
to=<CPETERS@BDP.COM>, delay=5+00:11:49, xdelay=00:00:01, mailer=esmtp, pri=43410934, [], dsn=4.0.0, stat=Deferred: Connection refused by

Aug 29 14:44:38 d1pr0004 sendmail[18374]: [ID 801593] k7OEWm909422:
k7TEf0A18374: sender notify: Cannot send message for 5 days

The following message sent from Exchange and returned non deliverable first appears to be a problem with the server "tpaexgw01". In fact the problem is with the mail server at "" which replied with the error message. The server "tpaexgw01" received the error message.

Our message did not reach some or all of the intended recipients.
The following recipient(s) could not be reached: on 8/31/2006 10:41 AM
<> #2.1.0 smtp; 452 4.3.1
Unable to accept message because the server is out of disk space.


Send a test message via the sendmail program.

# /usr/lib/sendmail -v

Sending mail attachments.

# /usr/bin/uuencode file.txt file.txt | mailx -s "Documents"

Making sense of mail queues.

# cd /var/spool/mqueue
# ls *BGCdrP21777
     dfg.....< is body of messages
     qgf.....< is header of messages
     xfg.....< is attachment

Changing the name of the sender.

#/usr/lib/sendmail -F
Subject: Booking
Your booking ZZZ is complete.

Make changes to the aliases file and apply via "newalias" command.

# /etc/mail/aliases
# newaliases


To determine the version of sendmail.

# /usr/lib/sendmail -d0 -bt < /dev/null | grep -i Version

Sending a test message by establishing a SMTP connection on port 25.

telnet 25 
mail from: <>
rcpt to: <>
Subject: Hello David
This is a test message.