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.

  1. Open a command prompt and type: telnet <mail_server_name> 25 (replace <mail_server_name> with the name of your mail server)
  2. Press Enter to establish the connection.
  3. Type HELO <your_email_address> (replace <your_email_address> with your email address) and press Enter.
  4. Type MAIL FROM:<your_email_address> and press Enter.
  5. 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.
  6. Type DATA and press Enter.
  7. Type the email message you want to send (e.g. "This is a test email") and press Enter.
  8. Type . (dot) and press Enter to send the email.
  9. 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.

  1. Install msmtp on your system if you haven't already.
  2. 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)
  3. 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.

  1. Install swaks on your system if you haven't already.
  2. 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)
  3. 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.

  1. Open a command prompt and type: nc <mail_server_name> 25 (replace <mail_server_name> with the name of your mail server)
  2. Press Enter to establish the connection.
  3. Type HELO <your_email_address> and press Enter.
  4. Type MAIL FROM:<your_email_address> and press Enter.
  5. Type RCPT TO:<recipient_email_address> and press Enter.
  6. Type DATA and press Enter.
  7. Type the email message you want to send and press Enter.
  8. Type . and press Enter to send the email.
  9. 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.