[Mailman-Users] Can mailman preprocess mails before doing the usual stuff?

Lena at lena.kiev.ua Lena at lena.kiev.ua
Fri Dec 12 21:10:06 CET 2003

> From: Nagy Gabor <linux42()freemail.c3.hu>

> I would like to modify the messages I send on my lists.
> I would like to recode the text parts, so that all messages sent out use
> the same encoding and character set, before doing anything else.

Find from where wrappers are called. In my case (Mailman 2.1.2,
Exim 4.24, licensed cPanel, Linux 2.4.20-19.7smp (Red Hat 7.3?))
I can edit /etc/valiases/MYDOMAINNAME (it's owned by my userid)
and it contains a line:

LISTNAME at MYDOMAINNAME: "|/usr/local/cpanel/3rdparty/mailman/mail/mailman post LISTNAME_MYDOMAINNAME"

If you know Perl then insert


after the | and write that script to do recoding (and changing charset
accordingly in the header). The script will have header and body on STDIN
and should output them to STDOUT, write nothing to STDERR and return 0
(exit, not die).

The script can be written in another language.
I plan to write such script for recoding between two main Russian
charsets (with charset autodetection if necessary) and decoding
base64 and quoted-printable in body and header, but it'll not be soon
(so far my list is on yahooGroups, I'm just preparing in case yahoo
requires to pay too much, and I already pay for web-hosting).

I have shell (SSH) non-root access, but it isn't necessary for
editing /etc/valiases/MYDOMAINNAME because CGI scripts are called
under my userid. I wrote and uploaded two CGI scripts - for reading
a file not in my home directory (unaccessible via FTP)
and for overwriting /etc/valiases/MYDOMAINNAME by edited version
I upload to my home directory:

#!/usr/bin/perl -w
$| = 1;
print "Content-type: text/plain\n\n";
$| = 0;
open( STDERR, '>&STDOUT' );
if ( m{[^\w\.\@/-]} or m{^home/MYUSERID} or m{/\.\./} ) {
  print "invalid parameter\n";
else {
  print "/$_\n\n";
  if ( open( IN, "/$_" )) {
    while ( <IN> ) {
    close IN;
  else {
    print "open failed: $!\n";

#!/usr/bin/perl -w
$| = 1;
print "Content-type: text/plain\n\n";
open( STDERR, '>&STDOUT' );
$from = '/home/MYUSERID/va';
$to = '/etc/valiases/MYDOMAINNAME';
if ( -e $from ) {
  print `cp $from $to`;
  print "\ncp exit status: $?\n";
  if ( unlink $from ) {
    print "\ndeleted\n";
  else {
    print "\nerror deleting\n";
else {
  print "doesn't exist\n";

More information about the Mailman-Users mailing list