Debianhelp.co.uk

 

 Postfix configuration in Debian

If you need to configure mail server in debian follow these steps

Mail User Agent(MUA)

The MUA is the program that a user uses to read his or her mail. Some examples: pine, thunderbird, Becky or Netscape and in Windows Outlook, outlook express. The MUA can use several protocols to fetch the mail. The most used services are POP3, IMAP, but SMTP is also possible.

 pop mail Configuration

All incoming mail for a user is per default stored in one file in /var/spool/mail/<username>. You could read your mail with more or less, but that is not very comfortable.

Another option is to use a mail directory called Maildir in a users home directory to store the mail. This is often used for IMAP.

The most secure way for fetching your mail is by using pop3 or IMAP over SSL.

Pop mail Installation

apt-get install courier-pop-ssl

Configuration File

The configuration can be found in /etc/courier/

Mail Transfer Agent(MTA)

The MTA is a program that sends mail from one server to another. This is done through the SMTP protocol. On Debian sarge the default MTA is Exim4, however there are several GNU/Linux servers that contain this functionality like: sendmail, postfix and qmail.

We are going to see Postfix and Exim4 MTA configurations.

Postfix

Next to it's MTA functionality we also use it's MDA(The MDA is a program that accepts incoming mail from the MTA and stores it in the users mailbox, Local Delivery. The program is on almost any GNU/Linux systeem procmail. We use the functionality within postfix for this) functionality by using the Maildir format for mail storage. Keep in mind that all mail for a user, when using Maildir, is stored in his/her home directory. This will grow the size of peoples home directory.

Postfix Installation

#apt-get install postfix

 Choose Satellite system when asked for configuration and supply what is needed.

Postfix configuration

The postfix configuration files can be found in /etc/postfix/.

The most important file is main.cf. Elements in this file that need special attention:

 myhostname = smtp.domain.com

mydestination = $myhostname, localhost.$mydomain, $mydomain
mynetworks = 192.168.3.0/24, 127.0.0.0/8
relay_domains = $mydomain
home_mailbox = Maildir/
 
The main configuration file main.cf looks like this
 
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
 
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
 
# appending .domain is the MUA's job.
append_dot_mydomain = no
 
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
 
myhostname = localhost.localdomain
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost.localdomain, localhost.localdomain, localhost
relayhost = new. test01.com
mynetworks = 127.0.0.0/8
mailbox_command =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only

Testing Our Postfix Configuration

Test the configuration with telnet:

telnet localhost 25            # from the local machine
telnet smtp.test.com 25       # from a Internet machine
telnet 195.14.60.1 25          # from an internal machine

 Use the following procedure:

Hi mara.net
mail from: sri@mara.net
rcpt to: user@lastre.com
data
.
quit
 
If you want postfix web interface or GUI tools click here
 

Mail Delivery Agent(MDA)

 

The MDA is a program that accepts incoming mail from the MTA and stores it in the users mailbox, Local Delivery. The program is on almost any GNU/Linux system procmail. We use the functionality within postfix for this purpose.

Configuring External Mail Boxes

 Fetch mail

It might be that you have some pop3 mail accounts on other servers or with other providers. To get that mail on your local system you should use fetchmail.

Fetch mail Installation

apt-get install fetchmail-ssl

 Fetch mail Configuration

A sample configuration file:

 
poll pop.dert.net proto pop3
user "paul", with password data45, is "paul" here;
 
Exim4 Configuration in Debian
 
Installing and Configuring Exim4 in debian with Spam assassin and ClamAV click here
 
If you want Exim4 web interface or GUI tools click here
 
Qmail Configuration in Debian
 
Installing and Configuring Qmail in Debian click here
 
If you want qmail web interface or GUI tools click here