Friday, July 31, 2009

Telnet +POP and SMTP Commands for send and retrieving mails

Telnet - POP Commands

To access your mailbox you need 4 things:

  • An active internet connection
  • The address of your pop mail server
  • Your username
  • Your password

The first thing to do is to open a connection from your computer to your mail server.
telnet pop.yourdomain.com 110 (default port is 110)
You should receive a reply like:
Trying ???.???.???.???...
Connected to pop.yourdomain.com
Escape character is '^]'.
+OK ready

Then log in:
USER username (yousrusername eg: username@yourdomain.com)

This should give you:
+OK Password required for userName.

Now give your password:
PASS passW0rd
+OK logged in.

To see a list of your emails awaiting collection use the
LIST command, this will also show you the id number of your messages (e.g. 1 or 2 etc.)
To view the contents of an email type
RETR + the id number of the message (e.g RETR 1).
To delete a message use
DELE + the id number of the message (e.g DELE 1).
To leave your mailbox and close the connection use
QUIT

Telnet - SMTP Commands

To access your mailbox you will need 3 things.

  • An active internet connection
  • The address of a mail server capable of relaying for you - usually provided by your dialup provider
  • A valid email address

The first thing to do is to open a connection from your computer to your mail server.
telnet smtp.yourdomain.com 25
You should receive a reply like:
Trying ???.???.???.???...
Connected to smtp.yourdomain.com.
Escape character is '^]'.

You will then need to delcare where you are sending the email from:
HELO smtp.yourdomain.com - dont worry too much about your local domain name although you really should use your exact fully qualified domain name as seen by the outside world the mail server has no choice but to take your word for it as of RFC822-RFC1123.
This should give you:
250 mail.domain.ext Hello smtp.yourdomain.com [loc.al.i.p], pleased to meet you

Now give your email address:
MAIL FROM: username@smtp.yourdomain.com
Should yeild:
250 2.1.0 smtp.yourdomain.com... Sender ok

Now give the recipients address:
RCPT TO: username@smtp.yourdomain.com
Should yeild:
250 2.1.0 user@smtp.yourdomain.com... Recipient ok


To start composing the message issue the command DATA

If you want a subject for your email type Subject:-type subject here- then press enter twice (these are needed to conform to RFC 882)

You may now proceed to type the body of your message (e.g. hello username@ smtp.yourdomain.com from username@smtp.yourdomain.com)

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

You can close the connection by issuing the QUIT command.
The mailserver should reply with something like:221 2.0.0 smtp.yourdomain.com closing connection
Connection closed by foreign host.



No comments: