How to use Telnet to send email over Port 25 using SMTP


A popular request coming in is from students who wish to become more proficient in general computing topics. For this, we at AskStudent will be writing a series of articles such as this article where we will talk about the Telnet command and how you can use it to access your mail server using Port 25 and sending an email to someone using nothing but your command prompt.

How to send Email using Telnet command over port 25 using the SMTP protocol

Telnet: TELNET (TELetype NETwork) is a network protocol used on the Internet or local area network (LAN) connections. It was developed in 1969 and standardized as IETF STD 8, one of the first Internet standards. Read more about Telnet in the Wikepedia article here 

SMTP: Simple Mail Transfer Protocol (SMTP) is the de facto standard for e-mail transmissions across the Internet. Read more about SMTP in this Wikipedia article here

Step # 1: First, open a command prompt. To open a command prompt window, click Start, Run and then type in cmd and press Enter. You can also press the +R to open the Run prompt and then type in cmd in the open text box.

Step # 2: You need to know a remote mail server. If you are still in school or working, there is the excellent opportunity to use your University mail server or your company’s mail server for this.

type in telnet RemoteMailServer 25 at the command prompt. The Remote mail server here in this command is the mail server of your school or company. It is usually or or something on those lines. When you press enter, you are shown a quick prompt that you are connecting to the remote mail server.

Step # 3: Introduce yourself to the mail server. Play around a bit.

type in helo mailhost at the command prompt. The mail server responds back with something like this

250 RemoteMailHost. Hello , pleased to meet you.

Step # 4: You can now enter your email address.

type in mail from: your email id @

The mail server responds back with a 250 … sender ok

Step # 5: You can now enter your receipient’s email address

type in rcpt to: recipient email id @

The mail server responds back with a “Recipient OK” message

Step # 6: Now, you are ready to type in the body of the email message.

type in data and press enter.

Now, type your message and then finally press Enter. To end your message type in a single period “.” . Your message is now in the queue

Step # 7: To complete and finish the process, type in quit and press enter. The mail server responds with a “Bye” after which you see a “Connection to host lost” message displayed.


If you liked this article, click here to buy me a beer!

25 replies to this post
  1. Today, I went to the beach front with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!|

  2. i m getting following error whilw using mail from command:

    530 5.7.0 Must issue a STARTTLS command first. t6sm2611039pbg.4

    i m using port 25 but i tried other ports suggested by gmail. but error is same.
    please help me out

  3. when i using these instruction i m getting this error:
    530 5.7.0 Must issue a STARTTLS command first. t6sm2611039pbg.4

    i am using i am using port 25. but i tried with 465 and 587 too i m getting same error
    help please

  4. i m geting error – “530 5.7.0 Must issue a STARTTLS command first. k9sm2376640pbc.38” after step 4.
    then when i write “starttls” then it shows “connection to host lost” .

  5. Guys,

    Please realize what you’re trying to do. This is for all intents and purposes a hack on an smtp server. Port 25 is the default smtp port, but don’t expect to be able to get through on this port, especially at places like yahoo and google. The last thing they’re going to promote is for a bunch of random people to generate email from unauthenticated addresses. An extreme amount of these are known as DOS attacks and as this point you’re officially commiting a computer crime.

  6. PLEASE HELP ME, im getting error saying “530 5.7.0 Must issue a STARTTLS command first. jq1sm10485973bkb.23”


  7. here are steps for authentication:
    telnet 587 (my email is at

    220 ESMTP mail_cia-ma08.6; date


    too much to write

    auth login

    334 VXMlcm5hbWU6
    enter email in BASE64

    334 UGFzc3dvcmQ6
    password in BASE64

    235 Authenticatoin successful

    then continue

  8. 220 ESMTP
    502 5.5.2 Error: command not recognized
    502 5.5.2 Error: command not recognized
    250 2.1.0 Ok
    553 5.7.1 : Sender address rejected: not logged in
    502 5.5.2 Error: command not recognized
    221 2.0.0 Bye

    i got this error,
    my smtp need authentication,

    where to key uid and pwd ?

  9. I am having a problem with gmail just like the first poster.

    The problem is that it asks to “STARTTLS” so i type “STARTTLS”

    STARTTLS begins.. and then i type the MAIL FROM command and it just closes…

  10. helo xyz

    250 Ok

    504 : Helo command rejected: need fully-qualified hostname

    Please can any one respond to me where i need to give the FQDN….

  11. The same problem of tejas s surve…is possible to attach a file( may be after encoding it using a MIME encoding)?

    • yeh u need to enable telnet just google how to enable telnet on vista, and click the 1st link and it shud tell u how

  12. Hi, I tried to make it work with yahoo but its asking for username and password, dunno how to give username and password. this is what i did

    telnet 25
    // I got this message: 220 smtp…. ESMTP
    then i typed: helo
    // i got this message: 220 smtp…
    then i typed: mail from:
    // i got this message: 530 authentication required … connection to host lost.

    can any1 help me!!!

    • Try to copy and paste rather than typing the mail from: & rcpt to: fields

      When typing type instead 25

      otherwise watch this it may help

  13. I dont think it will work with outside mail servers. You have to be with the network, like business or school network.

  14. I couldn’t get it to work. It just closed when i tried it with my gmail (google email) account and with my yahoo account. Could someone help me?

Leave a Reply