Testing Email Connections with Telnet

This is one of the essential troubleshooting tricks that an Exchange administrator needs to know, sending an email using telnet from command prompt.

Lets say you’ve just configured a relay connector and want to test it from the server that you wish to allow relay from before you let that server’s owner know that it is all set up for them. Or perhaps you want to quickly test whether a another email server on the internet is accepting mail from your network.

Note : This technique requires Telnet to be installed on the computer your running the test from. Windows XP and Windows 2003 came with telnet pre-installed anything newer you will have to install it

Installing The Telnet Client In Windows

To install the Telnet client on a windows computer use these steps.

  1. Open the control panel.
  2. Click on programs.
  3. Click on Turn Windows Features on and off.
  4. Scroll down the list until you see Telnet Client, and tick the box.
  5. Click OK and close the Control Panel.



First thing to do is to open a connection from your computer to your IMAP mail server. So open up your command prompt and type.

telnet mail.domain.ext imap

You should receive a reply like.

* OK Courier-IMAP ready. Copyright 1998-2002 Double Precision, Inc.

Then log in.

A login [email protected] mypassword

This should give you:


Select the folder you want to look in (usually the inbox)

B select INBOX

This should give you information about the contents of the mail folder..

* FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Draft \Answered \Flagged \Deleted \Seen) ] Limited
* OK [UIDVALIDITY 1021381622 OK
B OK [READ-Write] OK

When you have finished here’s how you quit.

C logout

This Should give you.

* BYE Courier-IMAP server shutting down
C OK LOGOUT Completed


The first thing to do is to open a connection from your computer to the POP mail server. So open up your command prompt and type.

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 yield.

+OK UserName has ? visible messages (? hidden) in ????? octets.

Then 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 (eg. 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.

Below is a list of problems and how to fix them.

-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 separate 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 mail server cannot write the temporary files needed to allow you to collect your mail – ask your ISP \ mail provider to check disk usage and allocation on the server.

-ERR [SYS/TEMP] Unable to copy mail spool file, quota exceeded (122)

The Mail Server 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 the server (this quota may be shared between your mail, web and userspace), alternatively contact  your ISP \ mail provider 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.


The First thing to do is to open a connection  from your computer to your mail server. So open up your command prompt and type.

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+gmtoffget;

You will then need to declare where you are sending the email from;


This should give you:

250 mail.domain.ext Hello (local ip)

Now give your sending email address.

MAIL FROM: [email protected]

and you should get a response like..

250 2.1.0 [email protected] .... Sender ok

Now give the recipients address.

RCPT TO: [email protected]

should yield..

250 2.1.0 [email protected]... Recipient ok

To start composing the message issue this command


If you want a subject for your email type..

Subject: --Type Subject here --

you will need to press enter twice once the subject is typed. (these are needed to conform to RFC 882)

You may now proceed to type the body of your message (e.g. hello [email protected] from [email protected])

To tell the mail server that you have completed the message enter a single ” .” on a line on it’s own and 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 mail server should reply with something like..

221 2.0.0 mail.domain.ext closing connection
Connection closed by foreign host.

Below is a list of problems and how to fix them.

501 [email protected]... 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 [email protected]... Relaying Denied

The mail server has refused to relay mail for you, this may be for a number of reasons but typical reasons include:

Not using the provider for an internet connection.
Your email host has blocked you for mass mailing.
Not using an email address provided by the owner of the server.




IT and security Expert with 20+ Years of Experience. _______________________________________________________ With over two decades of experience in the dynamic field of Information Technology and security, I have honed my skills to become a leading expert in safeguarding digital landscapes. My passion for technology and an unquenchable thirst for knowledge have driven me to stay at the forefront of the ever-evolving IT industry.

8 thoughts on “Testing Email Connections with Telnet

  1. Magnificent goods from you, man. I’ve keep in mind your stuff previous to and you’re just too great. I really like what you’ve obtained here, certainly like what you are saying and the best way through which you are saying it. You make it entertaining and you still take care of to stay it smart. I can not wait to learn far more from you. This is actually a terrific website.

  2. certainly like your website however you have to take a look at the spelling on quite a few of your posts. A number of them are rife with spelling issues and I to find it very troublesome to tell the truth then again I’ll definitely come again again.|

    1. Thanks for being honest, I will look into doing more proof reading in upcoming posts and look forward to getting more feedback from you in the future.

  3. It’s actually a nice and useful piece of information. I am glad that you shared this useful information with us. Please keep us informed like this. Thanks for sharing.

  4. Thank you for another informative web site. Where else could I get that type of information written in such a perfect way? I’ve a project that I am just now working on, and I’ve been on the look out for such info.

Leave a Reply

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

Scroll to top