Simple mailing list with Exim4

Even though installing and configuring a full-fledged mailing list software, such as Mailman, is not a very difficult task to do, for really simple use-cases one can get a away with by just adding an email alias and tweaking few settings of the MTA. This post shows how I did it with Exim4.

  1. Create a directory where you want Exim4 to archive your mailing list:

    mkdir /var/exim4lists
    chown Debian-exim:Debian-exim /var/exim4lists # uid and gid of your Exim4.
    
  2. Define delivery addresses for your mailing:

    cat >>/etc/aliases <<EOF
    mylist: /var/exim4lists/mylist, bob, alice
    EOF
    

    This will deliver all mail sent to mylist@example.com to /var/exim4lists/mylist, bob@example.com and alice@example.com.

  3. Write a simple filter file, which adds Reply-to: mylist@example.com -header:

    cat >/etc/exim4/filter <<EOF
    # Exim filter
    
    if first_delivery and $header_to: is "mylist@example.com" then
    if $header_Reply-to: is not "" then
    # Save the original Reply-to -address.
    headers add "X-Original-Reply-to: $header_Reply-to:"
    endif
    headers remove "Reply-to"
    headers add "Reply-to: mylist@example.com\n" # Reply to the list by default.
    endif
    EOF
    

    Now all replies to mails delivered via the mailing list will be sent back to the mailing list by default.

  4. Tell Exim4 where the filter can be found and allow Exim4 to write to files by inserting the following lines into the main configuration settings in /etc/exim4/exim4.conf.template:

    system_filter = /etc/exim4/filter
    SYSTEM_ALIASES_FILE_TRANSPORT = address_file
    
  5. Update the configuration of your running Exim4-process(es):

    invoke-rc.d exim4 restart
    

Comments

Comments powered by Disqus