How to test mail server from command prompt
There are several ways to test a mail server from the command prompt. Here are a few methods:
Method 1: Using the telnet
command
You can use the telnet
command to connect to the mail server's SMTP port (usually 25) and send a test email.
- Open a command prompt and type:
telnet <mail_server_name> 25
(replace<mail_server_name>
with the name of your mail server) - Press Enter to establish the connection.
- Type
HELO <your_email_address>
(replace<your_email_address>
with your email address) and press Enter. - Type
MAIL FROM:<your_email_address>
and press Enter. - Type
RCPT TO:<recipient_email_address>
(replace<recipient_email_address>
with the email address you want to send the test email to) and press Enter. - Type
DATA
and press Enter. - Type the email message you want to send (e.g. "This is a test email") and press Enter.
- Type
.
(dot) and press Enter to send the email. - Type
QUIT
and press Enter to close the connection.
Method 2: Using the msmtp
command
You can use the msmtp
command-line mail client to send a test email.
- Install
msmtp
on your system if you haven't already. - Open a command prompt and type:
msmtp -v -a <your_email_address> -t <recipient_email_address> -s "This is a test email"
(replace<your_email_address>
with your email address,<recipient_email_address>
with the email address you want to send the test email to, and the email message with the text you want to send) - Press Enter to send the email.
Method 3: Using the swaks
command
You can use the swaks
command-line SMTP client to send a test email.
- Install
swaks
on your system if you haven't already. - Open a command prompt and type:
swaks -f <your_email_address> -t <recipient_email_address> -s "This is a test email"
(replace<your_email_address>
with your email address,<recipient_email_address>
with the email address you want to send the test email to, and the email message with the text you want to send) - Press Enter to send the email.
Method 4: Using the nc
command
You can use the nc
command to connect to the mail server's SMTP port (usually 25) and send a test email.
- Open a command prompt and type:
nc <mail_server_name> 25
(replace<mail_server_name>
with the name of your mail server) - Press Enter to establish the connection.
- Type
HELO <your_email_address>
and press Enter. - Type
MAIL FROM:<your_email_address>
and press Enter. - Type
RCPT TO:<recipient_email_address>
and press Enter. - Type
DATA
and press Enter. - Type the email message you want to send and press Enter.
- Type
.
and press Enter to send the email. - Type
QUIT
and press Enter to close the connection.
These are just a few examples of how you can test a mail server from the command prompt. The specific commands and options may vary depending on your mail server and email client.