Simple mailing list with Exim4

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

    This will deliver all mail sent to to /var/exim4lists/mylist, and

  3. Write a simple filter file, which adds Reply-to: -header:

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

    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
  5. Update the configuration of your running Exim4-process(es):

    invoke-rc.d exim4 restart