Skip to Content.
Sympa Menu

Configure mail server: Postfix

Requirements

Two ways to integrate

There are two ways to integrate Sympa into Postfix:

The former is recommended. However, if you will never have plan to manage multiple domains, the latter is easier way.

You can not mix both ways. Following sections describe these two ways by each.

Virtual domain setting

Initial setting

Steps in this section may be done once at the first time.

  1. If path of sendmail executable file is differ from the default value of sendmail parameter, /usr/sbin/sendmail, define it in sympa.conf. For example:

    sendmail /usr/local/sbin/sendmail
    
  2. Create list_aliases.tt2 file in $SYSCONFDIR directory with following content:

    #--- [% list.name %]@[% list.domain %]: list transport map created at [% date %]
    [% list.name %]@[% list.domain %] sympa:[% list.name %]@[% list.domain %]
    [% list.name %]-request@[% list.domain %] sympa:[% list.name %]-request@[% list.domain %]
    [% list.name %]-editor@[% list.domain %] sympa:[% list.name %]-editor@[% list.domain %]
    #[% list.name %]-subscribe@[% list.domain %] sympa:[% list.name %]-subscribe@[%list.domain %]
    [% list.name %]-unsubscribe@[% list.domain %] sympa:[% list.name %]-unsubscribe@[% list.domain %]
    [% list.name %][% return_path_suffix %]@[% list.domain %] sympabounce:[% list.name %]@[% list.domain %]
    

    and edit it as you prefer.

    Edit sympa.conf to add following lines (Note: replace $SYSCONFDIR below):

    sendmail_aliases $SYSCONFDIR/sympa_transport
    aliases_program postmap
    aliases_db_type hash
    

    By these settings, sympa_transport file will be updated automatically when any lists are created, closed, restored or purged.

  3. Create empty map files (Note: replace $SYSCONFDIR below):

    # touch $SYSCONFDIR/transport.sympa
    # touch $SYSCONFDIR/virtual.sympa
    # touch $SYSCONFDIR/sympa_transport
    # chmod 644 $SYSCONFDIR/sympa_transport
    # chown sympa:sympa $SYSCONFDIR/sympa_transport
    

    and create databases (Note: replace $SYSCONFDIR):

    # postmap hash:$SYSCONFDIR/transport.sympa
    # postmap hash:$SYSCONFDIR/virtual.sympa
    # sympa_newaliases.pl
    

    Note

    • With steps above, sympa_transport file is world-readable and people may know all of the names of existing lists. To prevent it, follow the steps below after the steps above:
      # chmod 640 $SYSCONFDIR/sympa_transport $SYSCONFDIR/sympa_transport.db
      # chgrp postfix $SYSCONFDIR/sympa_transport $SYSCONFDIR/sympa_transport.db
      
      where postfix is the group the service processes of Postfix belong to.
  4. Edit Postfix master.cf file to add transport definitions (Note: replace $LIBEXECDIR below):

    sympa   unix    -       n       n       -       -       pipe
      flags=hqRu null_sender= user=sympa argv=$LIBEXECDIR/queue ${nexthop}
    sympabounce unix -      n       n       -       -       pipe
      flags=hqRu null_sender= user=sympa argv=$LIBEXECDIR/bouncequeue ${nexthop}
    

    A few notes:

    • flags attribute has to contain R. F is unnecessary.
    • null_sender attribute with empty value is required for Postfix 2.3 or later.
  5. Edit Postfix main.cf file to add configuration for virtual domains (Note: replace $SYSCONFDIR below):

    # virtual(8) maps
    virtual_mailbox_domains = (...existing parameter value...),
      hash:$SYSCONFDIR/transport.sympa
    virtual_mailbox_maps = (...existing parameter value...),
      hash:$SYSCONFDIR/transport.sympa,
      hash:$SYSCONFDIR/sympa_transport,
      hash:$SYSCONFDIR/virtual.sympa
    # virtual(5) maps
    virtual_alias_maps = (...existing parameter value...),
      hash:$SYSCONFDIR/virtual.sympa
    # transport maps
    transport_maps = (...existing parameter value...),
      hash:$SYSCONFDIR/transport.sympa,
      hash:$SYSCONFDIR/sympa_transport
    # For VERP
    recipient_delimiter = +
    

    Note

    • If mydestination parameter in main.cf file includes the virtual domain listed in virtual_mailbox_domains, Postfix outputs warnings to system log. Remove virtual domain(s) from mydestination.

Adding new domain

Steps in this section have to be done every time the new domain is added.

  1. Create directories for virtual domain configurations (Note: replace $SYSCONFDIR, $EXPLDIR and mail.example.org below):

    # mkdir -m 755 $SYSCONFDIR/mail.example.org
    # touch $SYSCONFDIR/mail.example.org/robot.conf
    # chown -R sympa:sympa $SYSCONFDIR/mail.example.org
    # mkdir -m 750 $EXPLDIR/mail.example.org
    # chown sympa:sympa $EXPLDIR/mail.example.org
    
  2. If you want to override global settings in sympa.conf (such as lang) by each domain, you can add it to robot.conf file above.

  3. If Sympa services have already been running, reload them (see "Reloading Sympa services").

  4. Add following contents to transport.sympa and virtual.sympa files and edit them as you prefer (Note: replace mail.example.org below).

    transport.sympa:

    mail.example.org                error:User unknown in recipient table
    sympa@mail.example.org          sympa:sympa@mail.example.org
    listmaster@mail.example.org     sympa:listmaster@mail.example.org
    bounce@mail.example.org         sympabounce:sympa@mail.example.org
    abuse-feedback-report@mail.example.org  sympabounce:sympa@mail.example.org
    
    

    virtual.sympa:

    sympa-request@mail.example.org  postmaster@localhost
    sympa-owner@mail.example.org    postmaster@localhost
    
    

    Note

    • If you want some addresses of mail.example.org to be excluded from mailing list service, you can add them to these files.

    Then, update databases for transport map and virtual alias map (Note: replace $SYSCONFDIR below):

    # postmap hash:$SYSCONFDIR/transport.sympa
    # postmap hash:$SYSCONFDIR/virtual.sympa
    
  5. Reload Postfix. Then test configuration according to instruction.

Single domain setting

  1. Edit sympa.conf to add following lines (Note: replace mail.example.org):

    domain mail.example.org
    aliases_program postalias
    sendmail /usr/local/sbin/sendmail  (If path is differ from the default)
    
  2. Save following excerpt as aliases.sympa.postfix file in $SYSCONFDIR and edit it as you prefer (Note: replace $LIBEXECDIR and mail.example.org below):

    # Service aliases for Sympa.
    sympa:                 "| $LIBEXECDIR/queue sympa@mail.example.org"
    listmaster:            "| $LIBEXECDIR/queue listmaster@mail.example.org"
    bounce:                "| $LIBEXECDIR/bouncequeue sympa@mail.example.org"
    abuse-feedback-report: "| $LIBEXECDIR/bouncequeue sympa@mail.example.org"
    sympa-request:         postmaster
    sympa-owner:           postmaster
    #listserv:             sympa
    #listserv-request:     sympa-request
    #majordomo:            sympa
    #listserv-owner:       sympa-owner
    

    If $SENDMAIL_ALIASES file does not exist, create it (Note: replace $SENDMAIL_ALIASES below):

    # touch $SENDMAIL_ALIASES
    # chmod 640 $SENDMAIL_ALIASES
    # chown sympa:sympa $SENDMAIL_ALIASES
    

    and create alias databases (Note: replace $SYSCONFDIR):

    # postalias hash:$SYSCONFDIR/aliases.sympa.postfix
    # sympa_newaliases.pl
    
  3. Edit Postfix main.cf file (Note: replace $SYSCONFDIR, $SENDMAIL_ALIASES and mail.example.org below):

    mydestination = (...existing parameter value...), mail.example.org
    alias_maps = (...existing parameter value...),
      hash:$SYSCONFDIR/aliases.sympa.postfix,
      hash:$SENDMAIL_ALIASES
    alias_database = (...existing parameter value...),
      hash:$SYSCONFDIR/aliases.sympa.postfix
    recipient_delimiter = +
    
  4. Reload Postfix. Then test configuration according to instruction.

Top of Page