Sending an e-mail via Telnet


Sending an e-mail via Telnet

In this document, we:

  • shall use Telnet to connect to the SMTP server.
  • shall give commands to the server, then type our e-mail, and finally tell the server, ‘Okay, the e-mail is done. Send it.
  • can then send more mails, or disconnect from the server.

The steps are quite similar to what you do when you send an e-mail from – for instance – Outlook Express. We are going to use the SMTP server of monitortools.com with the ID ‘webmaster’.


Step 1

Connect to the Internet in case you are a dial-up user. Open an MS-DOS prompt, and enter this command:

    C:\WINDOWS>telnet mail.monitortools.com 25

This will open a Telnet window, and within a short time, you will be connected to the SMTP server, and the server says:

    220 PROTAGONISTNT Mailmax version 4. 8. 3. 0 ESMTP Mail Server Ready

This varies, but you should definitely see the ‘220’ part. It is an indication that the server is ready to service your request.


Step 2

Now the server expects you to identify yourself. If you are a dial-up user, you can enter the name of your computer (the one Windows asks you when you intall Windows) or anything else you want. If you have a domain-name, then you should enter the domain-name here. My computer’s name is dell01, so I say:

    helo dell01

Note that it is ‘helo’ and not ‘hello’. The commands are not case-sensitive, so you can also say HeLo or HELO or hELo. The server replies:

    250 HELO 217.120.215.201, How can I help you?

This is like a shake-hand. You tell the server your name, and it says its name! Computers are quite friendly, you see!


Step 3

Next give the server your e-mail address. Note that most SMTP servers require that your e-mail address belong to the same domain as the server. For example, if you send mail from Yahoo! SMTP server, you should have a Yahoo! address. You cannot use it if you give it a Hotmail address. Let me give the SMTP server some e-mail address:

    mail from: webmaster@monitortools.com

‘mail from:’ is a SMTP command. Note that there is a space between ‘mail’ and ‘from’, followed by a colon (:). The server says:

    250 Ok

Step 4

Tell the server who you want to send the e-mail to. Let me send a mail to info@activexperts:

    rcpt to: info@activexperts.com

There are no restrictions here. You can enter any e-mail address. If there is some problem with the recipient-address, your mail will bounce, but for now, the server doesn’t complain. It will say:

    250 Ok

Step 5

You have told the server your e-mail address, and the recipient’s e-mail address, so now you can go ahead and type the e-mail. You have to do that with the data command:

    data

The server asks you to go ahead with your e-mail:

    354 End data with .

Don’t worry with the thing. It’ll be explained later.



Step 6

Now type in your e-mail, like this:

    This is a test e-mail.
    Remember to type it all right. Backspace key doesn't work in Windows
    Telnet, though it does in Linux. If you make a mistake, try pressing
    CTRL-h. If it works, well and good.
    .

When you finish your e-mail, press [ENTER], then a ‘.’, and again an [ENTER]. This tells the server that you have finished the e-mail, and it can send it. It will say:

    250 Ok: queued as 6AB5150038

Your mail was sent!


Step 7

Now you can either send another mail, or disconnect from the server. If you want to send another mail, you should repeat the ‘rcpt to:’ and ‘data’ commands. There is no need for ‘helo’ and ‘mail from:’, because the server already knows who you are. If you want to disconnect, just say ‘quit’:

    quit

The server will reply:

    221 Bye

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *