Results 1 to 2 of 2

Thread: Simple Mail Server

  1. #1
    Join Date
    Aug 2006

    Simple Mail Server

    The aim of this project was to set up a mailserver which would retrieve my emails from the ISP and then distribute them locally according to the name in the To: header. My ISP allows me to use several “aliases” therefore mail for me has and mail for my wife has in the To: header even though my account is This little project turned out to be very difficult because the configuration information for the various components was scattered about and there is also a lot of wrong configuration info out there. After a few days googling I managed to get the server to filter Barbara’s emails and put them in a directory that was reachable by her Outlook client.

    I used Postfix, Fetchmail, Procmail and Dovecot to make this work.

    Postfix: This was the easiest part, I installed Postfix, added the line home_mailbox = Maildir/ in /etc/postfix/ to make postfix use Maildir as opposed to Mbox and added the LAN address to “mydestination” and it just worked. Here is my Postfix config file.

    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    # TLS parameters
    smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
    myhostname = localhost
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    mydestination = localhost.localdomain, localhost
    relayhost =
    mynetworks =,
    mailbox_command = procmail -a “$EXTENSION”
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    home_mailbox = Maildir/
    inet_protocols = all
    Fetchmail: I added lines to .fetchmailrc make fetchmail send its output to Procmail. The .fetchmailrc resides in the $HOME directory, here is a copy.

    proto pop3
    user fred.smith
    password nottelling
    mda ‘procmail -f-’
    mda “/usr/bin/procmail -d %s” # tell fetchmail which MDA to use
    Procmail: The .procmailrc file also lives in the $HOME directory. There are two important points here:
    1) don’t forget the trailing “/” in the directory names as it informs Procmail to use Maildir format.
    2) The UMASK=007 is essential in order to make the moved mails readable by the group. Procmail automatically makes the owner the user using Procmail and sets the permission to owner only! The .procmailrc is here.

    # Put mail for barbara into mailbox barbara
    * ^To:.*barbara.smith
    Dovecot: There is some good information at the Dovecot WiKi but unfortunately it is hard to find as the site seems more interested in showing you how to use a Wiki than making it easy to navigate through the Dovecot information. In the Dovecot configuration file /etc/dovecot/dovecot.conf make sure that:
    1) listen = * or the IP address of your LAN, ie listen =, localhost.
    2) ssl_disable = yes at least for the setup phase. I intend to set up ssl etc now that I have everything working but getting it working was my first priority. Here is the confiuration file

    protocols = pop3 pop3s
    listen = *
    ssl_disable = yes
    disable_plaintext_auth = no
    log_timestamp = “%Y-%m-%d %H:%M:%S “
    mail_extra_groups = steve
    default_mail_env = maildir:/home/%u/Maildir/%u
    protocol pop3 {
    login_executable = /usr/lib/dovecot/pop3-login
    mail_executable = /usr/lib/dovecot/pop3
    pop3_enable_last = no
    pop3_uidl_format = %08Xu%08Xv
    auth default {
    mechanisms = plain
    passdb pam {
    userdb passwd {
    user = root
    Now it’s working but I will have to study the SSL features to make it really safe.

  2. #2
    Join Date
    Aug 2007
    Hasselt, Belgium
    Ubuntu 11.10 Oneiric Ocelot

    Lightbulb Re: Simple Mail Server

    Thank you!

    This is exactly what I needed!

    Just need to figure out how to read multiple mailboxes from same/different ISP's , and pipe these to the right mailbox on the server.

    Also check how to be able to choose from multiple "from:" (private or pro)

    Anyone a quick answer to this?

    No matter how great your product is, if you don't throw time and money against it it's a sh#tt# system. ubuntu <-> apple <-> microsoft


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts