Thursday, November 30, 2006

Survival: sending mail using telnet

This is useful, and I'm not able to learn the command sequence correctly... so I'm writing this post for the next time I'll need this!!!

1. Open a telnet connection to a mail server:
telnet mail.domain.ext 25
If the server is reachable and ready, it should reply something like:

Trying ???.???.???.???...
Connected to mail.domain.ext.
Escape character is '^]'.
220 mail.domain.ext ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?


2. Now let's define the domain from which you'll send this email:
HELO local.domain.name
It's better if you use you exactly qualifid domain name. The answer should be:
250 mail.domain.ext Hello local.domain.name [loc.al.i.p], pleased to meet you

3. Now your email address:
MAIL FROM: mail@domain.ext
Should yield:
250 2.1.0 mail@domain.ext... Sender ok
If not, there could be possible problems.

4. Now let's give the recipients address:
RCPT TO: mail@otherdomain.ext
This Should yield:
250 2.1.0 mail@otherdomain.ext... Recipient ok
If not, there could be possible problems.

5. To start composing the message issue the command DATA:
DATA

6. If you want a subject for your email type
Subject:-type subject here-
then press enter twice.

7. You may now proceed to type the body of your message

8. To tell the mail server that you have completed the message enter a single "." on a line on it's own.
The mail server should reply with:
250 2.0.0 ???????? Message accepted for delivery

9. You can close the connection by issuing the QUIT command.
The mailserver should reply with something like:
221 2.0.0 mail.domain.ext closing connection
Connection closed by foreign host.

No comments: