In my previous post I referenced common SMTP response codes and a general overview of how these responses are used in SMTP. This time I wanted to provide you with real examples using logs from VisNetic Mail Server.
Logs are such an important part of troubleshooting mail server delivery problems and outlining the basic SMTP conversation between a mail server and an email client or another mail server will help in understanding the logs. Let's start with a simplified log example showing the conversation. The following is a valid SMTP conversation.
S: = response from mail server.
C: = response from email client or Internet mail server
Incoming and Outgoing Explained. When an email client opens a connection for delivery it connects to a predefined hostname or IP address, when a mail server delivers mail it typically resolves the email address domain to an MX record (outgoing mail) and connects to a listening mail server on port 25. The mail server greets the connecting client with their domain name and possibly mail server type and version. The mail session continues with single responses from the mail server and client. For example, after the mail server responds with the server greeting message the client is required to respond with the next allowed command for SMTP. Once the client properly responses the mail server will respond accordingly. This continues until the message is delivered.
Mail Server sending outgoing mail. If your mail server is delivering outgoing mail the log will show commands in the reverse order. Your mail server is now acting as an email client sending outgoing mail to the Internet, here's an example,
VisNetic Mail Server log. The logs in VisNetic Mail Server are very detailed and provided information such as the IP address, session ID, whether it's a client or server response, incoming or outgoing, and all server/client code responses.
Read log from left to right, example,
IP Address, [Session ID], Time, '>>>' response from Server, '<<<' response from Client, command/response.
Successful Incoming Connection:
The IP address on an incoming connection is the IP of the remote mail server. If the message was to multiple recipients you would see multiple RCPT TO: commands referencing each recipient.
Failed Incoming Connection:
This incoming connection failed for unknown user.
>>> 550 5.1.1 unknown_user@test.com User unknown; rejecting
The response from the mail server was 550, which is a permanent delivery failure (all 5xx errors are permanent), and this would typically end the SMTP session unless multiple recipients were included in the message. See my SMTP Responses and Error Codes post for more info.
Successful Outgoing Connection:
The IP address for outgoing connections is the IP of the mail server it's connecting to, and the log also included 'Client session', indicating an outgoing message. Not all mail servers will log this way but a good indicator of an outgoing message is reference to resolving the MX record. Resolving the MX record is required for outgoing messages and VisNetic Mail Server indicates this with a system log entry 'DNS query 'yahoo.com' 0 (7) [OK - 1]'.
Failed Outgoing Connection:
This failed outgoing connection is to Yahoo.com.
<<< href="http://en.wikipedia.org/wiki/Greylisting">Greylisting. Your mail server will automatically retry delivery.
These SMTP log examples are fairly typical success/failure attempts and I hope it helps explains how to read SMTP logs.

