How to connect to POP3 server Linux

POP3, or Post Office Protocol 3, is the protocol used in most types of email accounts to control how email is delivered. When you get your email account from your ISP, they provide instructions for how to set up your account in an email client such as Windows Mail and Thunderbird. Included in those instructions are the incoming mail server (POP3) settings. If you aren’t sure you entered in the incoming mail server settings correctly, test your email POP3 server with the Command Prompt.

  1. Click "Start," type “cmd” -- without the quotation marks -- in the “Search programs and files” box and press “Enter” to open the Command Prompt.

  2. Type “telnet pop3.domain.net 110” -- again, without the quotation marks -- in the Command Prompt window. Replace “pop3.domain.net” with your own POP3 server and the number “110” with your incoming port number (in most cases it will still be 110).

  3. Press “Enter.” The message “+OK POP3 server ready” pops up after a short delay. Type “user ”, replacing “” with your own email address, then press "Enter."

  4. Type “pass password”, replacing “password” with your email account password, then press "Enter." Type “list,” press “Enter," then type “top 1 0” after it lists your messages. If it doesn’t list your messages, make sure you entered your server name, email address and password properly, and try again. If it lists your messages, your POP3 server has passed the test.

  5. Type “quit” and press “Enter” to exit the Command Prompt.

Dovecot is an open source application that allows you to receive emails on a Linux server in total security both through IMAP and POP3 protocol.

In this tutorial all the steps necessary to configure Dovecot on Ubuntu 18.04 are explained.

Setting up DNS records

Before proceeding with the actual installation of Dovecot, make sure that the domain records are set correctly.

Assuming you own the domain domain.com, first thing to do is set up a third level A record named "mail" and point it to the same address. Then to receive emails on your server, create an MX type record that points to the third level domain just created. 

HOST NAME TYPE VALUE
mail A [SERVER_IP]
  MX mail.domain.com

At this point you can connect to your server via an SSH connection. If you haven’t done so yet, following our guide is recommended to connect securely with SSH. In case of a local server, go to the next step and open the terminal of your server.

Dovecot installation

After connecting to the server via SSH, install Dovecot by running the following command:

$ sudo apt update && sudo apt install dovecot-core dovecot-pop3d dovecot-imapd

All Dovecot configuration files are present in the/etc/dovecot/directory. In this directory there are several files. Each file concerns a specific set of parameters included by the main file, once the service is started. The service i.e. dovecot.conf, should be modified as follows :

# Abilitiamo i protocolli IMAP e POP3 protocols = imap pop3 #Allows Dovecot to listen to all input connections (ipv4 / ipv6) listen = *, ::

Another important parameter is present in the configuration file /etc/dovecot/conf.d/10-mail.conf:

mail_location = maildir:~/Maildir

This parameter allows you to indicate the appropriate path for saving all the emails received from users. In the example above, the Maildir directory present in the home of the reference user is being set.

One more useful parameter in the file /etc/dovecot/conf.d/20-pop3.conf allows to maintain compatibility with some older Outlook clients:

pop3_uidl_format = %08Xu%08Xv pop3_client_workarounds = outlook-no-nuls oe-ns-eoh

Creating a user

The current Dovecot configuration is based on the users present in the system for accessing mailboxes. After completing the basic installation, proceed by creating the first user:

# User creation $ sudo useradd john -m # set password of user $ sudo passwd john# mails directory $ sudo mkdir /home/john/Maildir $ sudo chown john:john /home/john/Maildir $ sudo chmod -R 700 /home/john/Maildir

Firewall configuration

In case of a firewall on your system, configure it to enable mail traffic.

When using the UFW firewall, pre-installed profiles for Dovecot are provided. So let's see how to enable them.

To check the available profiles installed in the UFW firewall run this command:

A list similar to the following will be shown on the screen:

Available applications:   Dovecot IMAP   Dovecot POP3   Dovecot Secure IMAP   Dovecot Secure POP3   Nginx Full   Nginx HTTP   Nginx HTTPS   OpenSSH   Postfix   Postfix SMTPS   Postfix Submission

To allow mail traffic, enable Dovecot profiles. 

To check profile information:

$ sudo ufw app info "Dovecot IMAP"

After checking the profiles, you’re ready to enable them:

$ sudo ufw allow "Dovecot POP3" $ sudo ufw allow "Dovecot IMAP" $ sudo ufw allow "Dovecot Secure IMAP" $ sudo ufw allow "Dovecot Secure POP3"

Checking the operation of the mail server

To check the proper functioning of your POP3 server, use telnet. If it is not installed on your system, do it by running this command:

$ sudo apt install telnet

To start testing the mail server, start telnet:

$ sudo telnet localhost 110

If everything works correctly, the following output should be displayed on the screen:

Connected to localhost. Escape character is '^]'. +OK Dovecot ready.

Then enter the username and password using the user and pass command:

Once the login is completed, the server will send the following output:

To try to receive a real message, use the mail command provided by the postfix package (you can install Postfix following our guide How to configure a SMTP mail server with Postfix on Ubuntu 18.04): 

Once the email is sent, with the commands above, use telnet once again as above to access the mailbox:

$ telnet localhost 110 Trying ::1... Connected to localhost. Escape character is '^]'. +OK Dovecot ready. user john +OK pass test +OK Logged in.

Once logged-in, to get a list of the messages received run the list command:

list +OK 1 messages: 1 533 .

As you can see, you have an unread message: use the RETR command to access the content:

How do I connect to a POP3 server?

Configuring POP3 connection.
In the administration interface, go to Configuration > Delivery > tab POP3 Download..
In the Accounts section, click Add..
On the General tab, type the name of the POP3 server, and username and password of the POP3 account..

How do I find my POP3 server?

Find your Exchange mailbox server settings In Outlook Web App, on the toolbar, select Settings. > Mail > POP and IMAP. The POP3, IMAP4, and SMTP server name and other settings you may need to enter are listed on the POP and IMAP settings page.

What is POP3 in Linux?

The POP3 is a simple protocol and having very limited functionalities. In the case of the POP3 protocol, the POP3 client is installed on the recipient system while the POP3 server is installed on the recipient's mail server.

Which command does POP3 use to get a specific message?

Incoming email (POP3) uses port #110. ... POP3 Commands (Receive Email).