How to check mail server on linux

There are several ways to check a mail server on Linux:

  1. Using the telnet command:

You can use the telnet command to connect to the mail server and check if it's responding. Here's an example:

telnet mail.example.com 25

Replace mail.example.com with the hostname or IP address of your mail server, and 25 with the port number (which is the default port for SMTP).

If the connection is successful, you should see a response from the mail server. If you don't see a response, it may indicate that the mail server is not running or not responding.

  1. Using the nc command:

The nc command is similar to telnet, but it's more lightweight and can be used to test other network services as well. Here's an example:

nc mail.example.com 25
  1. Using the postmap command:

The postmap command is used to test the mail server's ability to deliver mail. Here's an example:

postmap -q "[email protected]" mail.example.com

Replace [email protected] with the email address you want to test, and mail.example.com with the hostname or IP address of your mail server.

If the command is successful, you should see a response indicating that the mail server is able to deliver the email.

  1. Using the dig command:

The dig command is used to perform DNS lookups. You can use it to check if the mail server's hostname is resolving correctly. Here's an example:

dig mail.example.com

If the command is successful, you should see the mail server's IP address and other DNS information.

  1. Using a mail client:

You can also use a mail client like mutt or msmtp to test the mail server. Here's an example:

mutt -H mail.example.com -s "Test email" [email protected]

Replace mail.example.com with the hostname or IP address of your mail server, [email protected] with the email address you want to test, and test email with the subject of the email.

If the email is delivered successfully, it indicates that the mail server is working correctly.

  1. Using a mail testing tool:

There are also several mail testing tools available, such as mail-tester.com or sendmail-test.com. These tools can help you test your mail server and identify any issues.

Remember to replace mail.example.com with the actual hostname or IP address of your mail server in all of these examples.