Bootstrap FreeKB - Postfix (Email) - Retrieve email using the Terminal
Postfix (Email) - Retrieve email using the Terminal

Updated:   |  Postfix (Email) articles

In the previous tutorial, we were able to retrieve emails from user1 inbox on the Dovecot email server itself, using telnet. Now we will retreive an email from user1 inbox using another computer in the LAN. Just for now, we are going to allow plaintext connections to our Dovecot email server.

In the /etc/dovecot/conf.d/10-auth.conf file, remove the comment from disable_plaintext_auth and ensure it is set to "no."

disable_plaintext_auth = no

 

In the /etc/dovecot/conf.d/10-ssl.conf, change ssl = required to ssl = yes.

ssl = yes

 

Restart Dovecot.

[root@server1 ~]# /sbin/service dovecot restart

 

From another computer in our LAN, let's try to retreive an email from our Dovecot email server. When using another computer in the LAN, we cannot connect with the command telnet localhost 110 or telnet localhost 143. Instead, the connection is made using the IP address or DNS name of the Dovecot email server. When following the Getting Started section of this series, if you added your Postfix email server to DNS, you can connect using the DNS name, such as telnet mail.example.com 110 or telnet mail.example.com 143. If you did not add your Postfix email server to DNS, you will need to use the IP address of your Postfix/Dovecot email server, such as telnet 192.168.0.5 110 or telnet 192.168.0.5 143. If all goes well, no error should appear, and the email should be retrieved.

First lets test this on port 110 (POP3).

C:\Users\username> telnet mail.example.com 110
Trying ::1...Connected to localhost.
Escape character is ^].
+OK Dovecot ready.
user user1+OK
pass password+OK 
logged in.
list 1 
4392 318.
retr 1+OK 
439 octets
Return-Path: <root@example.com>
X-Original-To: user1@example.com
Delivered-To: user1@example.com
Received: from localhost (localhost [IPv6:::1])
    by mail.example.com (Postfix) with ESMTP id DD8D385G83G
    for <user1@example.com>; Sun, 16 Aug 2015 00:30:08 -0500 (CDT)
Message-Id: <201607010182227.BFB1B1001D@mail.example.com>
Date: Sun, 10 Jul 2016 00:00:01 -0500 (CDT)
From: root@example.com
Hello World.
quit+OK 
Logging out.
Connection closed by foreign host.

 

Let's test this on port 143 (IMAP).

C:\Users\username> telnet mail.example.com 143
Trying ::1...Connected to localhost.
Escape character is ^].
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAN] Dovecot ready.a login user1 passworda OK [CAPABILITY IMPA4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORE SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE] 
Logged in
a list "" "*"* 
LIST (\HasNoChildren) "." 
INBOX
a OK
list completed
a examine inbox* 
FLAGS (\Answered \Flagged \Deleted \Seen \Draft)* OK
[PERMANENTFLAGS ()] Read-only mailbox.* 2 EXISTS* 0 RECENT* OK [UNSEEN 2] First unseen.* OK [UIDVALIDITY 1468252124] UIDs valid* OK [UIDNEXT 3] Predicted next UIDa OK [READ-ONLY] Examine completed (0.000 secs).a fetch 1 body[]* 1 FETCH <BODY[] {439}Return-Path: <root@example.com>X-Original-To: user1@example.comDelivered-To: user1@example.comReceived: from localhost (localhost [IPv6:::1])    by mail.example.com (Postfix) with ESMTP id DD8D385G83G
    for <user1@example.com>; Sun, 16 Aug 2015 00:30:08 -0500 (CDT)Message-Id: <201607010182227.BFB1B1001D@mail.example.com>
Date: Sun, 10 Jul 2016 00:00:01 -0500 (CDT)
From: root@example.com
Hello World
)
a OK Fetch completed
a logout* BYE Logging out
a OK Logout completed.
Connection closed by foreign host.

 

Next we will install and configure Mozilla Thunderbird to work with our Postfix and Dovecot email server.

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 562fa3 in the box below so that we can be sure you are a human.