How to Test an SMTP Server: Connection, Login and Sending

How to Test an SMTP Server: Commands and Codes | Mailpro

To test an SMTP server, check five things in order: the server name exists, the port answers, the server greets you, the encryption works and your login is accepted. Then send one real email. Every step uses a command that is already on Windows, macOS or Linux, and the whole test takes about five minutes. This guide gives the exact commands, shows what a healthy answer looks like (tested on Mailpro™'s own SMTP server in November 2026) and explains what each reply code means when a step fails.

What does an SMTP test check?

An SMTP test is a series of small checks. Each one fails in its own way, so the step where the test stops tells you what to fix.

Check What it proves What a failure looks like
1. Server name The address you typed exists "Non-existent domain" or "can't find"
2. Port Nothing blocks the way between your machine and the server Timeout or "connection refused"
3. Greeting A mail server is listening and ready No 220 line, or the connection closes at once
4. Encryption The connection is protected and the certificate is valid Handshake error or certificate warning
5. Login Your username and password are accepted 535 or 530
6. Sending The server takes a message from you 550, 554 or "relay denied"

What you need before you start

  • The server name, for example smtp.mailpro.com.
  • The port: 587 in most cases, 465 as the second choice. The differences are in SMTP ports explained.
  • Your SMTP username and password. These are often not the ones you use to log in to the provider's website. For Mailpro, see where to find your SMTP server details.

Run the test from the machine that sends the email: the web server, the shop or the office computer. A test from your laptop says nothing about a firewall that sits in front of your website.

Step 1: Check that the server name exists

Open a terminal (PowerShell on Windows, Terminal on macOS or Linux) and type:

nslookup smtp.mailpro.com

You should get an IP address back. If the answer is "Non-existent domain" or "can't find", the name is misspelled or the DNS record is missing, and nothing else will work until that is fixed.

Step 2: Check that the SMTP port is open

On Windows, in PowerShell:

Test-NetConnection smtp.mailpro.com -Port 587

On macOS or Linux:

nc -zv smtp.mailpro.com 587

A healthy answer is TcpTestSucceeded : True on Windows, or a line ending in succeeded! on macOS and Linux. A timeout means something between you and the server blocks that port: a firewall, your internet provider or your hosting company. Try 587, then 465. On Mailpro's server, ports 587, 465 and 25 answer.

Step 3: Read the greeting and check the encryption

This command opens the connection, switches on encryption (STARTTLS) and lets you talk to the server. Use it for port 587:

openssl s_client -starttls smtp -crlf -quiet -connect smtp.mailpro.com:587

For port 465, where encryption starts straight away, use:

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

When the connection is open, introduce yourself:

EHLO test.example.com

The server lists what it supports. This is the real answer from smtp.mailpro.com:

250-smtp.mailpro.com Hello test.example.com
250-PIPELINING
250-8BITMIME
250-SMTPUTF8
250-SIZE 20971520
250 AUTH PLAIN LOGIN
  • Lines starting with 250 mean the server accepted your greeting.
  • AUTH PLAIN LOGIN shows the login methods the server offers.
  • SIZE 20971520 is the largest message the server accepts, in bytes (20 MB here).

To check the certificate, run the same command without -quiet and look for this line near the end: Verify return code: 0 (ok). Any other code means the certificate has expired or does not match the server name. Type QUIT to close the connection.

openssl s_client -starttls smtp -connect smtp.mailpro.com:587

Two practical notes. On Windows, openssl is not installed by default; it comes with Git for Windows (open Git Bash). And keep -quiet when you plan to type more commands: without it, openssl reads a line starting with R or Q as one of its own commands.

Testing because emails from your website or app are not arriving? The Mailpro SMTP relay service includes 500 emails free during the 30-day trial, with no credit card.

Step 4: Test your username and password

SMTP sends the username and password encoded in base64. Encode each one first. On macOS or Linux:

printf 'username' | base64

On Windows, in PowerShell:

[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('username'))

Then, in the session you opened in step 3, type AUTH LOGIN and paste the two encoded values when the server asks for them:

AUTH LOGIN
334 VXNlcm5hbWU6
(your username in base64)
334 UGFzc3dvcmQ6
(your password in base64)
235 ...

235 means the login worked. 535 means the server refused the username or password: copy them again from your provider's settings page, because one missing character is the usual cause. Mailpro's server also tells you how many attempts you have left. Base64 is an encoding, not encryption, so do this only after the encryption in step 3 is on, and close the terminal afterwards. More on this in SMTP authentication with Mailpro.

Step 5: Send a real test email

The last check is a real message. Create a text file called message.txt with these five lines:

From: you@yourdomain.com
To: you@yourdomain.com
Subject: SMTP test

This is a test.

Then send it with curl, which is included in Windows 10 and later, macOS and Linux. Replace the addresses and the username with yours; curl asks for the password. In Windows PowerShell, type curl.exe instead of curl.

curl --url "smtp://smtp.mailpro.com:587" --ssl-reqd --mail-from "you@yourdomain.com" --mail-rcpt "you@yourdomain.com" --user "username" --upload-file message.txt -v

A line starting with 250 at the end means the server accepted the message. Send it to an address you own and check that it arrives in the inbox, not in spam. If the server answers 550 or 554, the table below tells you why.

What do the SMTP reply codes mean?

Every answer from an SMTP server starts with three digits. Codes starting with 2 or 3 are good news, 4 means "try again later" and 5 means "refused".

Code What it means What to do
220 The server is ready Nothing: this is the greeting
250 Command accepted Nothing: go on to the next step
334 The server is waiting for your username or password Paste the base64 value
235 Login accepted Nothing: your credentials work
354 The server is waiting for the text of the message Send the message and end with a single dot on its own line
221 The server closes the connection Normal after QUIT
421 Service not available for the moment Wait a few minutes and try again; too many connections is a common cause
450 / 451 Temporary refusal Try again later; the recipient's server may be busy or checking new senders
530 Login required, or encryption must start first Switch on STARTTLS, then log in
535 Username or password refused Copy the SMTP credentials again; check you are not using your website login
550 Recipient refused, or relay denied Check the address; log in before sending
554 Message refused Often reputation or content: check SPF and DKIM for your domain
Timeout or "connection refused" The port is blocked or the server name is wrong Go back to steps 1 and 2; try port 587
Certificate error Expired certificate or wrong server name Use the exact server name your provider gives

For the fix behind each error, see the most common SMTP errors and how to fix them.

Are online SMTP test tools safe?

Websites that test an SMTP server for you are quick and need no terminal. Keep two limits in mind:

  • They test from their network, not yours. They can tell you the server is up, but not that your web host blocks port 25 or 587.
  • Your password leaves your hands. A tool that checks only the server name and the port is safe. If a tool asks for your SMTP password, use it only on a site you trust, with a test account, and change the password afterwards.

The test passes, but emails still go to spam

An SMTP test proves that the server accepted your message. It does not prove the message reached the inbox. That depends on your domain's authentication and on the reputation of the server that sends for you. Check that SPF, DKIM and DMARC are set up for the domain in your From address. If the emails come from a WordPress site, read why WordPress emails go to spam.

The test works on my computer but fails on the server

This is the most common surprise. Many hosting and cloud providers block outgoing port 25, and some block every mail port until you ask. Run steps 1 and 2 on the server itself. If port 25 times out there, switch your website or app to port 587 with STARTTLS. If you are still choosing a provider, see what an SMTP server is and how to choose one and free SMTP servers and their limits.

How to test Mailpro's SMTP server

Use smtp.mailpro.com with port 587 (STARTTLS) or 465 (SSL/TLS), and the SMTP username and password shown under Settings → SMTP in your account. Every command in this guide works as written. After step 5, open your SMTP delivery statistics: each message appears there with its status, delivered, opened, clicked or bounced, so you see what happened after the server said 250. A shorter version of this test is in how to check your SMTP connection.

Frequently asked questions

How do I test an SMTP server on Windows without telnet?

Use PowerShell. Test-NetConnection followed by the server name and -Port 587 tells you if the port is open, and curl.exe sends a test email. Telnet is not needed and is no longer installed by default on Windows.

Can I test an SMTP server without sending an email?

Yes. Steps 1 to 4 check the server name, the port, the encryption and your login without sending anything. Type QUIT after the login test.

Which port should I use for an SMTP test?

Start with 587, the standard port for sending from a website, an app or a mail program. Use 465 if 587 is blocked. Port 25 is meant for mail servers talking to each other and is often blocked by internet and hosting providers.

How do I know if port 25 is blocked?

Run the port check in step 2 with 25 in place of 587. If 587 succeeds and 25 times out against the same server, your provider blocks port 25.

How do I test an SMTP relay?

The same way. A relay is an SMTP server that sends on behalf of your website or app, so the six checks apply. Add one more: send from the address your application really uses, because a relay accepts only the senders and domains you have set up.

Mailpro SMTP relay

An SMTP server that passes the test

Connect your website or app, send from your own domain with TLS, SPF and DKIM, and see what happened to every message. 500 emails free during the 30-day trial, no credit card, servers in Switzerland.

Start free with MailproSee the SMTP relay service

You might also be interested in:

If you use transactional or mass email sending in your business, you’ve probably heard the term SMTP. But when it comes to managing large volumes of emails efficiently and ensuring top deliverability, another concept becomes esse...
With Mailpro you can integrate your application, ecommerce or website through SMTP or API. Which one you decide to use depends on your needs, which is more convenient for you, and on the amount of money you would like to invest i...
An SMTP server is the mail server that sends outgoing email. Your email client, website or application hands it each message using SMTP (Simple Mail Transfer Protocol); the server checks who you are, finds the recipient's mail se...
SMTP uses four ports: 25, 465, 587 and 2525. Use port 587 with STARTTLS to send email from an application, website or email client; use 465 if your software only supports implicit TLS; keep 25 for server-to-server delivery; and t...
If you have just finished with your email newsletter, you must know that clicking on that send button can be nerve-wracking. As challenging as it to write a compelling newsletter, it is equally hard to tell if our newsletter is m...