How do I troubleshoot outbound email on Linux?

Check which MTA is being used

First, determine which mail transfer agent (MTA) you are using. Currently, Eclipse Linux servers are configured using the postfix MTA. If you are running an older system, you may be using the sendmail MTA. To determine which MTA you are running, use the following command:

ls -l /etc/alternatives/mta

If the command returns a link to “/usr/sbin/sendmail.postfix”, your system is configure to use postfix. If it returns a link to “/usr/sbin/sendmail.sendmail”, your system is configured to use sendmail.

Check the SMTP relay server

Next, verify that your system is pointing to the correct SMTP relay server.

For systems using postfix, the command is:

grep ^relayhost /etc/postfix/main.cf

For systems using sendmail, the command is:

grep ^DS /etc/mail/sendmail.cf

Check the mail logs

Once you have confirmed that the MTA is relaying to the correct SMTP server, the next step is to check the email service logs. To view the last 10 log messages and monitor the file, run:

tail -f /var/log/maillog

Check the mail queue

Once you have checked the mail logs, the next step is to check the mail queue for pending and differed email messages.

mailq

Tell Postfix to process the queue now

postqueue -f

Delete all queued mail

postsuper -d ALL

Send a test message from the command line

To send a test message from the Linux command line, use the following command (replace email@domain.com with your email address):

echo test | mail email@domain.com

If you don’t receive your email, check the logs (see above) for error messages.

Send a test message from Eclipse

In a separate Eterm or Solar window, try sending an email. If you don’t receive the message, check the logs (see above). Make note of any error messages, such as “relay denied” or “cannot connect to SMTP server.” These messages are the best source for determining which element in the email service architecture is incorrect. In our experience, most issues are related to incorrectly configured SMTP relay servers, or SMTP servers that do not allow relay from the Eclipse server.