Send e-mail via TELNET

by Sharan R

E-Mail Servers...

Controlling e-mail servers directly can be quite interesting, and fun. This document will show some very basic ways of sending and receiving e-mail using the mail servers directly.

Sending e-mail...

Most e-mail is sent using SMTP (simple mail transfer protocol) servers. The mail programs logs into that server, sends e-mail, and logs you off. You can do that yourself! SMTP servers reside on port 25 of your e-mail server. Usually, the name is mail.yourisp.com. You telnet into that server using a telnet program. A telnet program is available to almost anybody; under UNIX and Windows. You telnet to port 25! i.e.:

telnet mail.yourisp.com 25
Once you've logged on, the server expects a greeting. The greeting is in the form of "HELO yourip." Luckily, you don't need to type in your IP (most of the time) and can just use a dot in it's place.. i.e.:

HELO .
You should note that the "dot" has spaces on BOTH SIDES! Once you've said HELO, you can start sending e-mail. First, you specify who's sending e-mail. This has to be an e-mail address with a valid server (the server's name has to exist, and DNS server has to verify it...) Usually, this would be your real e-mail; but if you're using this approach, obviously, you'd want to avoid your real e-mail. Thus, you can make up any e-mail! For example: root at NO SPAM yahoo dot com would do pretty well. It will make it seem as though the e-mail has some from there... ;-) (NOTE: do not use yahoo.com as your server!!! I like their services, and I don't want to cause them any bit of problems.) You continue by specifying:

MAIL FROM: root at NO SPAM yahoo dot com
You could also have said:

MAIL FROM:
It doesn't really matter as long as you tell the server who "you are"... Then, you have to specify the location where you want to send your e-mail... you do this:

RCPT TO: victim@somewhere.com
You could also have said:

RCPT TO:
Once you specified the location of your victim (recipient ;-), you can begin the e-mail by typing:

DATA
Note, that the first several lines you type after DATA might have special meaning. For example, after DATA, you can type:

FROM: Mr.Phreak
TO: Victim
SUBJECT: The subject of the e-mail...
You can of course, type in more screwy info... most of the rest are pretty much not standard, and will not be compatible with text only e-mail readers. Note that you don't need these lines... they're only for the receiving program to put for the user "who sent you the e-mail" mgs... avoiding them will simply leave the e-mail with no subject, the "TO" field will have "undisclosed recipient;" and the "FROM" field will have your e-mail you've specified in the "MAIL FROM" field. After these three lines, you can being your e-mail text. The text can be anything, and multi-lined. You end the e-mail by typing a dot at the beginning of a line. For example, you end the e-mail this way:

see you later ;-)
.
See that little dot at the last line? To quit from the server, you simply type QUIT... i.e.:

QUIT
After QUIT, the server disconnects you. Notice that the only revealing thing in the e-mail will be your IP address. Which if you use a publicly available workstation (the library), and/or telnet into several other servers before hand, will pretty much be hard to trace...

Receiving E-Mail...

Receiving e-mail using a mail server directly isn't much fun. (and most of the times, I'd definitely not recommend it.) Anyway, there are times where this comes in useful. (for example, deleting junk mail without downloading it...)

Most people read e-mail using a POP3 mail server. A POP3 server resides on port 110, usually referred to as "pop3"... you telnet into that server by:

telnet mail.yourisp.com pop3
You could also have said:

telnet mail.yourisp.com 110
As soon as you logon, the server is in it's AUTHENTICATION mode... and expects you to type in your username and password. You do this by:

USER username
PASS password
If you make an error, you can try again... (it will let you know that the password/username is not valid...) Once you logon, you'll be in the TRANSFER mode... (or something) At that point, you can see how many msgs you got, and read them. For example, you can type:

STAT
To give you statistics about your e-mail... (basically, the size of e-mails...) Similar goes for the LIST command... i.e.:

LIST [msg]
The [msg] there is optional, if you want to find out stuff about an individual e-mail, you use it. (I almost always use LIST with no parameters). After you know how many e-mails you got, you can read (well...almost) each individual e-mail by typing:

RETR msg
Where "msg" is the e-mail number gotten from LIST command. The only disadvantage is that if the e-mail is large, it just zoomes past you, and you can hardly read it... (that's why I suggest an e-mail program)

To delete an e-mail you type:

DELE msg
This deletes (marks as deleted) the msg number pointer to by "msg". I say "marks as deleted" because it doesn't actually get deleted at that point. It will only be deleted when you leave the server. You can actually undelete the e-mails by typing:

RSET
That's it for the standard (required) POP3 commands, but MOST servers implement the optional ones as well... (which I won't describe here) However, I'll mention the most useful one (at least to me), the TOP msg n.

TOP msg n
Where the msg is the msg to display, and n is the number of lines to display... thus, you can see the header of an e-mail, without reading (or downloading) the whole e-mail.

You leave the server by typing QUIT...i.e.:

QUIT
At this point, the server deletes all the msgs marked as deleted (cleans up stuff), and waits for the next logon...

A suggestion is not to take up the POP3 server for a long time... since when you've logon, it locks everything. (and somebody who's sending you e-mail might not be able to get through on some configurations)

That's it for handling the e-mail servers directly. Most of these though, are more conveniently used in a small networking program... (writing your own mail client...) In which case, you'd want to take a look at [RFC1939] document for POP3, and [RFC822] document for SMTP.

NOTE: A very important note, most of these servers don't echo back the characters, thus, if you're typing, you won't see your text appear in the telnet window. (To fix it under Windows, you setup your terminal window to echo the characters locally.) Under UNIX, you can just telnet into another machine, that way, that other machine will echo the characters to you (not the mail server).

Good luck! (and don't use this info to send hard to trace junk mail)

Note: Most of the ISP would hve blocked port 25 by default. try for ur luck
0 Response to 'Send e-mail via TELNET'

Post a Comment