How to test mail server in linux

There are several ways to test a mail server in Linux:

  1. Using the telnet command:

    telnet localhost 25

    This will establish a connection to the mail server on port 25 (the default SMTP port). You can then type commands like HELO or EHLO to test the server's response.

  2. Using the nc command:

    nc localhost 25

    This is similar to using telnet, but nc is a more powerful tool that allows you to send and receive data.

  3. Using a mail client:

    mutt -s "Test email" [email protected]

    This will send a test email to the specified recipient using the mutt mail client.

  4. Using the msmtp command:

    msmtp -v -a [email protected]

    This will send a test email to the specified recipient using the msmtp command-line mail client.

  5. Using the postfix command:

    postfix -v -c /etc/postfix/main.cf -o mydestination=localhost

    This will start the Postfix mail server in debug mode and allow you to test its functionality.

  6. Using a mail testing tool:

    swaks -s localhost -f [email protected] -t [email protected]

    This will send a test email to the specified recipient using the swaks mail testing tool.

  7. Using the mail command:

    mail -s "Test email" [email protected]

    This will send a test email to the specified recipient using the mail command-line mail client.

  8. Using the sendmail command:

    sendmail -v -t < /dev/null

    This will send a test email to the specified recipient using the sendmail command-line mail client.

  9. Using the mailx command:

    mailx -s "Test email" [email protected]

    This will send a test email to the specified recipient using the mailx command-line mail client.

  10. Using a mail server testing tool:

    mail-tester.com

    This is a web-based tool that allows you to test your mail server's functionality and receive feedback on its performance.

Remember to replace localhost and [email protected] with the actual hostname and email address of your mail server and recipient.