POP and SMTP through Telnet

Communicating with POP and SMTP servers through Telnet

POP commands

The first thing to do is to open a connection from your computer to your mail server.
telnet mail.domain.ext 110
You should receive a reply like:
Trying ???.???.???.???...
Connected to mail.domain.ext.
Escape character is '^]'.
+OK ready


Then log in:
USER userName
This should give you:
+OK Password required for userName.

Now give your password:
PASS password
Should yeild:
+OK userName has ? visible messages (? hidden) in ????? octets.

If it doesn't please see possible problems.

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

Here are a list of common POP problems and their fixes
-ERR [AUTH] Password supplied for "userName" is incorrect.
The password supplied was not the one expected by the server, retype the password, failing that find out if you've got the correct password.

-ERR [AUTH] PAM authentication failed for user "userName": Authentication failure (7)
Your mailbox could not be broken down into seperate emails correctly, there may be a remnant of a message left - Ask your ISP to edit the mailbox manually and look for free lines above the headers.

452 4.4.5 Insufficient disk space; try again later
The mailserver cannot write the temporary files needed to allow you to collect your mail - ask your ISP to check disk useage and allocation on the server

-ERR [SYS/TEMP] Unable to copy mail spool file, quota exceeded (122)
The mailserver cannot create a temporary file needed to allow you access to your mailbox as you've run out of your space allocation - Try to reduce the amount of disk space you are using on that server (this quota may be shared between your mail, web and userspace), alternatively contact your ISP to increase your quota.

-ERR [IN-USE] /???/???/.userName.pop lock busy! Is another session active? (11)
The mailbox is currently in use by another connection or an old connection has terminated uncleanly - This will deal with itself

Overquota locking file '/???/???/???/userName.lock'; lock proceeding anyway


Unable to process From lines (envelopes) in /???/???/???/userName; change recognition mode or check for corrupted mail drop.
The mailbox cannot be split into seperate messages because the pop server cannot recognise distinct boundaries or the boundaries do not include the whole mailbox


SMTP commands

The first thing to do is to open a connection from your computer to your mail server.
telnet mail.domain.ext 25
You should receive a reply like:
Trying ???.???.???.???...
Connected to mail.domain.ext.
Escape character is '^]'.
220 mail.domain.ext ESMTP Sendmail ?version-number?; ?date+time+gmtoffset?


You will then need to delcare where you are sending the email from:
HELO local.domain.name - 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 local.domain.name [loc.al.i.p], pleased to meet you

Now give your email address:
MAIL FROM: mail@domain.ext
Should yeild:
250 2.1.0 mail@domain.ext... Sender ok

If it doesn't please see possible problems.

Now give the recipients address:
RCPT TO: mail@otherdomain.ext
Should yeild:
250 2.1.0 mail@otherdomain.ext... Recipient ok

If it doesn't please see possible problems.

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 mail@otherdomain.ext from mail@domain.ext)

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 mail.domain.ext closing connection
Connection closed by foreign host.



Here are a list of common SMTP problems and their fixes
501 nouser@nosuchplace.here... Sender domain must exist
The domain that you are sending from must exist

503 Need MAIL before RCPT
A recipient has been specified before a sender.

550 mail@domain.ext... Relaying Denied
The mail server has refused to relay mail for you, this may be for any number of reasons but typical resons include:
Not using this provider for an internet connection and/or
Not using an email address provided by the owner of the server.