[Mailman-Users] footer

Simon White simon at mtds.com
Fri Jan 31 17:29:10 CET 2003


31-Jan-03 at 12:45, Fernando Schapachnik (fernando at schapachnik.com.ar) wrote :
> En un mensaje anterior, Jon Carnes escribió:
> > Forgive my lack of exact language.  To be more precise, you can turn on
> > personalization for a list using the Web-Admin. Once you do that certain
> > other features become available and you can then edit the Footer (using the
> > Web-Admin) and put in variables that will be recognized and replaced by
> > Mailman with things like the persons email address, the list name, the admin
> > address, etc.  There is no need to know anything except the names of the
> > variables to use in the footer.
> 
> Sorry to be insistant, but this is not what I need. I don't need a different
> footer for each subscriber. I need a different footer for each post, but
> the same to all subscribers.
> 
> I realize that I gain some extra footer variables if I turn personalization on,
> but fail to see how any of them relate to including the output from an external
> commands. Think about including the fortune output in the footer, for example.

Put a wrapper around the aliases, for example:

list-name at listserver.com	"|/usr/bin/mywrapper|/home/mailman/mail/mailman post list-name"

Then the script mywrapper could be like this:

#!/bin/bash
while read line
do
echo "$line"
done

fortune=`/usr/games/fortune`

echo "-- "
echo $fortune

However, I'm not sure that double pipes are allowed in sendmail or
Postfix. This is just a quick idea. Maybe you can pipe the output from
mywrapper directly to the "mailman post" command, like this...

Aliases file:

list-name at listserver.com	"|/usr/bin/mywrapper"

--- START SCRIPT ---
#!/bin/bash
# Simple filter to add footer to email read from stdin

# Define a temporary filename
TMPFILE=msgfile

# Delete the temporary file if it already exists
if [ -f $TMPFILE ]; then
rm $TMPFILE
fi

# read from STDIN line by line, outputting to temp file
while read line
do
echo "$line" >> $TMPFILE
done

# Now get the output from Fortune ;-)
fortune=`/usr/games/fortune`

# Add RFC footer/signature delimiter
echo "-- " >> $TMPFILE

# Now add the fortune we got above
echo $fortune >> $TMPFILE

# Now use cat to redirect the output of $TMPFILE to mailman
/bin/cat $TMPFILE | /home/mailman/mail/mailman post list-name

--- END SCRIPT ---

Notes:

- Please let me know if this was useful to anyone.
- This will break posts with attachments, it is ONLY good for plaintext
  posts. If you want to get cleverer with files with attachments your
  script will have to be MIME aware.

Regards,

-- 
|-Simon White, Internet Services Manager, Certified Check Point CCSA.
|-MTDS  Internet, Security, Anti-Virus, Linux and Hosting Solutions.
|-MTDS  14, rue du 16 novembre, Agdal, Rabat, Morocco.
|-MTDS  tel +212.3.767.4861 - fax +212.3.767.4863



More information about the Mailman-Users mailing list