To troubleshoot or analyze a particular problem on a mail server you may need to take a closer look at the actual SMTP traffic being sent to and from your mail server. Using a Network Capture tool can uncover problems not seen by the mail server. Let's take a look at what can be accomplished with this tool.
- You can check whether SMTP traffic is arriving at the mail server, verifying that traffic is not blocked by a firewall or router sitting between the mail server and the Internet or an email client.
- You can check if DNS requests are being made to your DNS server (MX lookups).
- You can check the exact format of DATA being sent to and from your router.
- You can view email client request for POP3, IMAP, or SMTP.
How to create a SMTP Network Capture:1.
Download and install a Network Capture tool. In our example we'll use
Wireshark, which can be downloaded from
www.wireshark.org. Note: if you have a firewall installed on your mail server computer it may interfere with how the network capture works and you may need to temporarily disable the firewall to get a complete capture.

2.
Start capture. Start the capture by selecting Start from the Capture --> Interfaces... menu. If you have multiple Interfaces select Start on the Interface that sends and receives email. After pressing the Start button the network capture will begin.
3.
Enter filter term. Enter the term 'smtp', without the single quotes, in the Filter box of the main screen and press Apply.
4.
Reproduce problem. Attempt to reproduce the particular problem you want to analyze, for example, have an email client send mail.

5.
Displayed SMTP traffic. You will see the SMTP traffic appear in the main window. When done, you can stop the capture and optionally save the capture to file for future analysis.
Definitions of capture:Source column. The source is where the packet originated, for example, if your local IP is in the Source column this means the mail server initiated that packet.
Destination column. The Destination is the IP that the Source is sending to, for example, if the destination is a remote IP address this is where the mail server is sending the packet.
Protocol column. The Protocol is the type of request made by the Source. In my example I'm filtering on SMTP so you should only see SMTP in the Protocol column. If you changed filtering to DNS you would see all captured DNS/
ICMP packets.
Analysis:
If you want to get a little more involved in analyzing the packets on your mail server you can remove the 'smtp' filter, press Apply, and view all packets on the selected interface. On a busy system this will likely flood the live capture with a lot of packet data and requires a good understanding of networking to analyze all the data. For the sake of simplicity I'm not going to go into a complete packet capture but only focus on SMTP. However, it may be necessary to analyze all packets to find problems on your network not related to the mail server. For more info on packet errors and other network captures see the Wireshark help, they actually have very good help files.
Once you have captured the required SMTP data you can analyze it by clicking on an SMTP line at the top and it will show the related capture in the corresponding fields below that, the actual data is located in the bottom field and provides you with the data being sent back and forth between the mail server and the connecting client or server.
SMTP Capture Explained. I'm showing a successful SMTP session but in the event when SMTP fails you would see responses from the connected client or server that should provide details of why the session failed. For example, let's say your analyzing the DATA command to see if all data is sent to your mail server, including the "." on a line by itself indicating the end of DATA transmission (see the
Wiki SMTP description for more info on communications). If your network capture does not show the "." on a line by itself your mail server will assume that there's more DATA to receive and will wait until it does receive the ".", or it will timeout. The error in your SMTP log will likely report a failed session without real cause for failure.
Causes for Failure. Likely causes for this type of failure are down stream gateways, routers attempting to filter mail prior to sending to your mail server, desktop virus scanner on your mail server interfering with delivery, the sending client or server is not complying with SMTP protocol, or network configuration issues (MTU, etc...) or there could be a hardware failure or network card driver issue.
Conclusion. If you are unable to determine why email delivery is failing and your mail server logs are not providing enough information about the failure, try using a network capture tool to capture the actual SMTP traffic, the capture may provide enough details that lead you to a solution to the problem.