Big picture

The Software we will use

The configuration described here uses these software components (the versions are Debian Squeeze's default versions):

  • Postfix (2.7.1) for receiving incoming emails from the internet and doing basic checks
  • Dovecot (1.2.15) to store emails on hard disk and allow users to access their emails using POP3 and IMAP
  • Roundcube (0.3.1) as a webmail interface so users can read their emails using a web browser
  • MySQL (5.1.49) as the database backend storing information about domains, user accounts and email forwardings
  • AMaViS (2.6.4) for content scanning incoming emails using ClamAV and SpamAssassin
  • Clam Antivirus (0.97) for virus checking
  • SpamAssassin (3.3.1) for spam checking

The wonderous ways of an Email

Before going into the details let's see the big picture:

  1. An email is sent to your server via the SMTP protocol on TCP port 25. Postfix accepts the connection, reads the email and does some basic checks. Is the sender blacklisted on a realtime blacklist? Is the email from an authenticated user so we bypass relay checks? Or is the recipient of the email a valid user on our system? If we don't trust the remote system yet we apply greylisting. At this stage Postfix can reject the email or accept it.
  2. Postfix forwards the email via the SMTP protocol on the TCP port 10024 to AMaViS for content checking. Notice that at this stage the email can't be rejected any more. So AMaVis can either accept it or throw it away. Commonly AMaViS is configured to add a certain email header so the user can see that AMaViS thinks it is spam.
  3. AMaViS lets SpamAssassin check the email for spam. SpamAssassin will be taught which emails are spam to increase its detection accuracy.
  4. AMaViS also runs the email through ClamAV to see if it contains any viruses.
  5. After these checks AMaViS returns the email to the Postfix process but on TCP port 10025. Postfix is configured to trust emails sent to this port so further content checks are skipped.
  6. Postfix forwards the email to Dovecot. Dovecot can optionally apply per-user filters so that emails can be stored in certain email folders automatically if desired.
  7. Dovecot writes the email to the hard disk in maildir format.
  8. The user's email client can now fetch the new emails from Dovecot using the POP3 or IMAP protocol.

8 Comments

Hi, nice work, hope for a

Hi,

nice work, hope for a soon release.

Here's a litte correction from my side:

I think step 6 is wrong in the picture, you mean Dovecots LDA, or? (auth is for SASL)


Greetings from germany,

Shuro

url RoundCube

Hello

Great tutorial, I used the Lenny version a few weeks ago!

The url for RoundCube is not right, it points to squirrelmail.org now.

Greets from Holland,

Wilco

Well!

I can't wait for this work to be completed.

Today (yesterday now!) I read through the Lenny version from begining to end and was amazed at how brilliant it was.

As someone who has written basic articles for my local LUG, I know how much effort goes into producing even a small tutorial, let alone something as complex as this.

I have a Debian Lenny web server running at present and it's been faultless. So the next stage for me, is to upgrade it to Squeeze and introduce an email server on to the machine as well. I shall do this on a spare test machine and once I'm happy it's configured correctly, swap it into "production" and take my web server off line to be similarly configured. (I always have a back-up server ready).

To my mind, there is no greater gift than the passing of knowledge. So you should be rightfully proud of your tutorials and your generous gift to all of us.

Thank you.

Awesome

Wonderful post! We are linking to this great content on our site.
Keep up the great writing.
Regards, <a href="http://www.grosirtas.co/tas-cantik-1/">harga tas etnik maika</a>