Test a POP3 mailserver

To Test a POP3 Mailserver from Linux you only need an open terminal, telnet or openssl installed. Then it is simply a matter of opening a connection to your server and sending it some commands. It is the same commands that your GUI mail client will be doing.

Reading Emails

The following is how to read your emails. To open a connection you can use either telnet or openssl if the connection is to be encrypted.

telnet mailserver.dragon.lab pop3
openssl s_client -connect mailserver.dragon.lab:995

The above openssl command returns the ssl certificate you can stop that from happening by using the -quiet flag.

Both of the commands above should return a message

* OK Dovecot (Ubuntu) ready.

The following listing shows how to find out the directories available on the server for the user you logged in with and how to grab the first email from the server.

  • The commands you type are in bold.
  • They can be in upper or lower case.
  • Any text after the command can be in quotes “” to allow you to send escape characters or white space.

USER fred@dragon.lab
+OK
PASS fredsmailpassword
+OK Logged in.
LIST
+OK 1 message:
1 1629
.
RETR 1
+OK 1629 octets
Return-Path:
Delivered-To:
Received: from mailserver.dragon.lab
by mailserver.dragon.lab (Dovecot) with LMTP id lscAMP8jTFjdCgAAEtR2Vw
for ; Sat, 10 Dec 2016 15:49:19 +0000
Received: from localhost (localhost [127.0.0.1])
by mailserver.dragon.lab (Postfix) with ESMTP id B9C4E40D02
for ; Sat, 10 Dec 2016 15:49:19 +0000 (GMT)
X-Virus-Scanned: Debian amavisd-new at dragon.lab
X-Spam-Flag: NO
X-Spam-Score: -1
X-Spam-Level:
X-Spam-Status: No, score=-1 required=6.31 tests=[ALL_TRUSTED=-1]
autolearn=ham autolearn_force=no
Received: from mailserver.dragon.lab ([127.0.0.1])
by localhost (mailserver.dragon.lab [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id m6M1uA3-zLiJ for ;
Sat, 10 Dec 2016 15:49:18 +0000 (GMT)
Received: from [10.1.200.4] (unknown [10.1.200.4])
(using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits))
(No client certificate requested)
(Authenticated sender: fred@dragon.lab)
by mailserver.dragon.lab (Postfix) with ESMTPSA id D8A7A40D01
for ; Sat, 10 Dec 2016 15:49:17 +0000 (GMT)
To: Fred Bloggs
From: Fred Bloggs
Subject: testing the mail server
Message-ID: <7e1b96cd-ee38-35a7-8fa4-867d0e571c6a@dragon.lab>
Date: Sat, 10 Dec 2016 15:49:17 +0000
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

This is your first test email.

Fred
.
QUIT
+OK Logging out.
Connection closed by foreign host.

Now you can test a POP3 mailserver from the command line by reading emails.

Leave a Reply

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