Tue, 20 May 2008

Email Round-Robin using Procmail

— SjG @ 2:56 pm

The need arose to have a specific email address round-robin (e.g., cycle through a collection of destination email addresses).

A solution was achieved through use of procmail and a little perl script. It probably could be done more easily and/or better, but I figured other people might find this interesting.

So, first, an alias was created in /etc/aliases (used by postfix in this case, but it should work for sendmail, and variants should work for other MTAs):

rrtest:         |"/usr/bin/procmail -m /etc/postfix/roundrobin_procmail.rc"

Then, the following file was saved as /etc/postfix/roundrobin_procmail.rc:

:0 w:/tmp/rrlock
                ! ${dest}

And then, of course, we need the perl program. Here’s /etc/postfix/

# ----------------------------------------------------------
@recipients = (

$index_file = 'rr-index.txt';

# ----------------------------------------------------------

$index_exists = 1;
        $index = 0;

if ($index > $#recipients)
        $index = 0;
print OUT "$index\n";

print STDOUT $recipients[$index];

exit 0;

Elegant? Not really. But it seems to work 🙂

Thu, 1 May 2008

Oh for April

— SjG @ 11:25 am

As in, zero. Gar nichts. Zero posts in April, to match the zero posts for February. You might just figure that I’m lacking initiative on this writing stuff.

Chalk it up to:

  • Being busy at work.
  • Writing code on the side.
  • Playing with Photoshop Javascripts to create strange flower Mandalas.
  • Having shoulder pain (due to inexplicable adhesive capsulitis — an ailment typically found among diabetic women aged 5-70 [!?]).
  • Reading very slowly through massive anthologies rather than shorter works (currently about half way through the collected stories of Washington Irving).
  • General Springtime ennui.

Perhaps May will see more activity. Perhaps not.

Filed in: