How to Test an SMTP Server

To test an SMTP server, you can use several approaches depending on whether you want a quick connectivity check or a full send/receive test.

1. Check Basic Connectivity (Telnet or OpenSSL)

The simplest way to test an SMTP server is to check whether you can connect to it on the correct port. With Telnet, you can run:

telnet smtp.example.com 25

Replace smtp.example.com with your server and 25 with the port, which is usually 25, 465, or 587. If the connection succeeds, you’ll see a banner such as 220 smtp.example.com ESMTP Postfix. From there, you can manually issue SMTP commands:

EHLO test.com
MAIL FROM:<you@example.com>
RCPT TO:<someone@example.com>
DATA
Subject: Test SMTP
This is a test email
.
QUIT

For servers requiring TLS or SSL, you can use OpenSSL instead:

openssl s_client -connect smtp.example.com:465 -crlf -quiet

Once connected, the same SMTP commands can be typed to send a test message.

2. Use Command-Line Tools

On Linux or macOS, you can use a utility like swaks (Swiss Army Knife for SMTP), which simplifies testing authentication and sending. For example:

swaks --server smtp.example.com --from you@example.com --to someone@example.com --auth LOGIN --auth-user you@example.com --auth-password yourpassword

On Windows, PowerShell provides a quick way to test as well. You can run:

Send-MailMessage -From you@example.com -To someone@example.com -Subject "SMTP Test" -Body "Test message" -SmtpServer smtp.example.com -Port 587 -UseSsl -Credential (Get-Credential)

Both approaches allow you to verify not just connectivity but also authentication and message delivery.

3. Use an Email Client (Functional Test)

Another way to test an SMTP server is to configure an email client such as Outlook or Thunderbird. You’ll need the SMTP server address, the correct port (25, 465, or 587), the authentication credentials, and whether SSL/TLS is required. Sending a test message through the client provides a practical, end-to-end check of the server’s functionality.

In WordPress, you can easily do this using SMTP Mailer.

4. Check Logs

If you manage the server, reviewing its logs gives valuable confirmation of whether connections and deliveries are occurring. For Postfix, you’ll typically look in /var/log/maillog or /var/log/mail.log. For Exim, the relevant file is /var/log/exim_mainlog. For Sendmail, you’ll also check /var/log/maillog.

Leave a Comment