Jump to Navigation

109 - Postfix(SMPT) & Dovecot(pop3, imap) for ubuntu server

1. Postfix (SMTP)

Postfix is the default Mail Transfer Agent (MTA) for Ubuntu. It is in Ubuntu's main repository, which means that it receives security updates.
This explains how to install and configure postfix and set it up as an SMTP server.

In order to install Postfix with SMTP-AUTH and TLS, first install the postfix package from the Main repository using your favorite
package manager. For example:

# sudo apt-get install postfix

You need to edit /etc/postfix/main.cf (or sudo dpkg-reconfigure postfix )for your environment.

# vi /etc/postfix/main.cf

#------- Sample ------------------------
mydomain = mydomain.com
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost
inet_interfaces = all
mynetworks =
transport_maps = hash:/etc/postfix/transport
smtpd_banner = $myhostname ESMTP unknown
smtpd_client_restrictions = permit_mynetworks, reject

If you send an e-mail from the internal mail server
as a defferent domain name like :

# vi /etc/postfix/transport

myserver.internal.ad     :
mydomain.com           smtp:[216.98.98.xx]
*                       error:This delivery not allowed

To create index file (like transport.db) :

# postmap /etc/postfix/transport

Start postfix process :

# /stc/init.d/postfix start


2.Devecot (pop3, imap)

Dovecot is a Mail Delivery Agent, written en with security primarily in mind. It supports the major mailbox formats:
mbox or Maildir. It is a simple and easy to install MDA. This explains how to set it up as an IMAP or POP3 server.

# sudo apt-get install dovecot-imapd dovecot-pop3d

IMAPS and POP3S are more secure than the simple IMAP and POP3 because they use TLS encryption to connect.

Once you have chosen protocol, amend the following line in the file /etc/dovecot/dovecot.conf

# vi /etc/dovecot/dovecot.conf

protocols = pop3 pop3s imap imaps

To enable plain text logins when not using a secure protocol, put the following line in /etc/dovecot/dovecot.conf :

disable_plaintext_auth = no

To start dovecot process.

# /etc/init.d/dovecot start

In order to access your mail server from another computer, you'll have to configure your firewall or
router to allow connections to the server on the necessary ports :

* IMAP - 143
* IMAPS - 993
* POP3 - 110
* POP3S - 995

You'll also need to uncomment following line in /etc/dovecot/dovecot.conf :

listen = *


Main menu 2

Story | by Dr. Radut