How to send Emails from Command Prompt.

This is my first post. one of my Friends asked me how to send email from command prompt. So i decided to publish it on my blog.

To send an email from SMTP Telnet client must be installed on your computer.
In windows XP Telnet is already installed but on Windows Vista/Seven you have to install telnet from Control Panel. 

Install Telnet on Windows Vista/Seven :
To install Telnet in Windows Vista/Seven go to Control Panel > Programs and Features > Turn Windows feature on or off  > Check telnet client on this box and click ok.
Telnet is installed on your machine now.
How to send Emails from Command Prompt.
How to send Emails from Command Prompt.

Send Email From Command Prompt (Telnet/Smtp): 
To send an email to particular email address first you need to connect that server by telnet.
Here i am taking gmail.com as an example.

Step 1. Go to http://www.mxtoolbox.com type "gmail.com" in MXLOOKUP box. once you will submit it will give you the IP address and Mail servers host name. For Gmail.com the IP address and mail server host names are as shown below.

How to send Emails from Command Prompt.
How to send Emails from Command Prompt.

Step 2. Copy the first IP address and Go to command prompt.
            Type: " telnet 173.194.77.26 25 "  and hit enter.
How to send Emails from Command Prompt.
How to send Emails from Command Prompt.

Once you will hit enter you will get a banner of smtp server that will look like this:
How to send Emails from Command Prompt.
Step 3. Now Type " ehlo hi "  and hit enter.

Once you hit enter you will get following response.
250-mx.google.com at your service, [106.197.10.206]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250 ENHANCEDSTATUSCODES

Step 4. once you get response from SMTP server type  " mail from:<abc@example.com>" here abc@example.com is the email address from which you want to send email.
Note: This email address can be anything it does not need to be gmail.com email address.
for example here you can type : billgates@microsoft.com :D

You will get following response.

250 2.1.0 OK bl9si5353282obb.40

Step 5. Now type " rcpt to:<reciever@gmail.com> " and hit enter.

You will get following response.

250 2.1.5 OK t2si6832220oef.28

Step 5. Now type " data " and hit enter.

For gmail you will get following response, but different server may give different response so don't worry.

354  Go ahead t2si6832220oef.28

Step 6. Now type following commands and hit enter

subject: Hi This is a test email
from: abc@example.com
to:<reciever@gmail.com>
Hi buddy how are you. this is a
Don't reply to this email. :P

Once you finish typing your message here..
Just hit enter twice and then type dot "." and hit enter.

You will get the following response.

220  Mail queued for delivery.


How to send Emails from Command Prompt.
220  Mail queued for delivery.
if you are sending email to your own gmail or some other account then please check it spam folder, they have SPF record checking enabled so the email might go to spam folder.

If you have any queries then Email Me : admin@technodew.com