Recent Articles

How to Send Email To SMTP Server From Command Line

There is a easy way to test your SMTP server from the Windows command line or Linux shell. The email system was created before the advancement of the web browser and the internet so you can imagine the network protocol used is very simple. All you need is to connect to a specific port and send in a series of text commands.

SMTP runs on the well-known port 25. From your command prompt, you should be able to telnet to that port and send a few text commands unless your administrator has explicitly blocked you. In this example, I'm going to send an email to a Hotmail account directly from my computer.

From your command line, type the following command. If your admin allows you to telnet to port 25, you should be seeing the welcome message below.

C:\>telnet 25

220 Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at Violations will result in use of equipment located in California and other states. Tue, 31 Jul 2007 04:49:17 -0700

Type HELO to introduce yourself. The remote machine will reply and greet you.

HELO localmailer
250 ( Hello []

If your SMTP server is expecting authentication, you can pass the username and password in Base64 encoded following the AUTH LOGIN command. In the example below, the "d2VsZG9u" is the username and "dzNsZDBu" is the password in Base64 encoding:

334 VXNlcm5hbWU6
334 UGFzc3dvcmQ6
235 2.0.0 OK Authenticated

Now, tell the server where you're sending the email from.

250 OK

Specify a recipient email to send the test email to. Enter a valid Hotmail address (yours preferably so you can check the results).


Type DATA to begin entering the subject and the rest of the email body.

354 Start mail input; end with .


Enter a single period (.) on a new line to indicate end of message.

250 <> Queued mail for delivery

That's all. You can now disconnect the session by typing QUIT.

221 Service closing transmission channel
Connection to host lost.

There you go, if you entered all the commands correctly as shown, you should now have received an email in your Hotmail account.

Subject: This is a test

Please disregard this test email.