(as)  [sysadmin] [blog]

User Tools

Site Tools


kiss_procmail_lists

kiss_procmail_list.rc

A procmail based script to run simple and small mailing lists

Description

kiss_procmail_list.rc allows to create simple and small mailing lists to facilitate e-mail communication of a bunch of people. It is definitely no replacement for full-blown mailing lists such as provided by Mailman. It's for cases where all their features are not required and the number of participants fit into a procmail recipe ;-)

(Non-)Features

  • Tries to be simple
  • Requires only procmail, formail, awk, sed, grep, and some sendmail
  • Shortcomings
    • Checks only validity of "From:" address1), and only if wrapped in <…>2)
    • No automatic handling of (un)subscription
    • No support for adding header or footer text to messages
    • No archiving
    • No VERP support3)
    • No automatic handling of bounces
    • Messages to multiple lists are sent only to 14)
  • Features
    • Verification of senders' "From:" header addresses
    • Supports "nomail" subscription status
    • Subject tagging
    • Workaround for subscribers whose mail gets blocked due to invalid DKIM headers or DMARC reject policies such as Yahoo (rewrites the "From:" to "Original Name via NameOfList <List@address>" and removes DKIM and other headers)
    • Optionally add list of subscribers to messages (if message is text/plain, multipart/mixed, or multipart/related)
    • Not fool-proof

Usage/Installation

The script is installed in the .procmailrc of the person who will be the list-moderator, who will be in charge of subscribing and unsubscribing participants and who will receive messages which were intended for the list but didn't fit the criteria.

So, create an alias address for the list that points to the account where the script is included. For example, add the following to /etc/aliases assuming that coolrat is the username of the list-moderator:

example-l: coolrat

In coolrat's .procmailrc setup the list by setting the required variables (see the script for details) and then INCLUDERC the script itself. For example:

# KISS example mailing list
LISTNAME="eXample-L"
LISTADDRESS="$LISTNAME@example.net"
LISTFILE="$HOME/example_list_subscribers.txt"
INCLUDERC="$HOME/kiss_procmail_list.rc"

Finally, we need to add the e-mail addresses of the participants to example_list_subscribers.txt. The format is 1 address per line wrapped in < and >. For example:

<coolrat@example.net>
<coolalias@example.net> nomail
<otherrat@example.org>

Postfix forwarding loop workaround

When I installed the script on my account running Postfix my own address was of course included and triggered Postfix' mail forwarding loop detection. So, we need to carefully work around it. Here's an example of what I used:

# --- KISS mailing list example for Postfix
 
# deliver list moderation messages straight away
:0
* ^List-Kiss:
$DEFAULT
 
LISTNAME="eXample-L"
LISTADDRESS="$LISTNAME@example.net"
LISTFILE="$HOME/example_list_subscribers.txt"
:0
* $ ^((Resent-)?To|CC): (.*<)?$LISTADDRESS(>|$)
{
  # workaround postfix mail loop bouncing for our own address
  :0 f
  * !$ ^(From|Return-Path:|List-Id:) .*$LISTNAME
  * ^Delivered-To: coolrat@example\.net$
  | formail -I Delivered-To:
 
  # other settings, e.g.
  LISTMAXSIZE=999999
 
  INCLUDERC="$HOME/kiss_procmail_list.rc"
}

Download

kiss_procmail_list.rc + helper script example kiss_procmail_list_mod.sh

For the old version 1 of the script see kiss_procmail_list1.rc.

Disclaimer

Use at your own risk! Not much tested yet, tried only on Debian 7 & 8. Feedback and bug reports welcome.

1)
The script checks whether the sender's "From:" address is "subscribed" to the list. Optionally, this can be turned off, and one can setup other means of sender verification.
2)
If support for the syntax From: someone@example.com (Name) is required, currently, it is recommended to rewrite the header before it hits our script.
3)
It'd be trivial to add VERP but it's pointless since the number of participants should be small anyway and bounces are handled manually.
4)
Probably, one could work around this limitation with some more procmail foo. Right now, the script is a "delivering recipe". So, even if it is included/run multiple times, a single message is delivered only once unless a "c" flag is used to generate a carbon copy.
kiss_procmail_lists.txt · Last modified: 2022-03-21 21:44 by andreas

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki