[Mailman-Users] Custom header

Jim Tittsler jwt at onjapan.net
Thu Sep 2 08:03:17 CEST 2004


On Aug 31, 2004, at 13:42, David Cake wrote:

> 	I guess my questions really is 'do the existing per-list 
> customisation options include any way of changes to the mail headers 
> beyond what is already accessible from the GUI?'
> 	And, as a followup, if it requires source code level changes, is 
> there a sane and sensible way of doing these on a per list basis so my 
> installation remains upgradable? I know python, but I'm in no hurry to 
> make by installation unmaintainable.

I think the best way to do this sort of thing is add a handler to that 
list's pipeline that does the processing you want.  If you created a 
DavidsHeader.py in your Mailman/Handlers directory that contained 
simply:

#
# DavidsHeader.py
"""Add a list specific header
"""

def process(mlist, msg, msgdata):
     msg['X-Davids-Header'] = 'my header text'

And then add that handler to the pipeline for the list in question (say 
after the CookHeaders handler) using withlist:
$ bin/withlist -l mylist
 >>>m.pipeline.insert(m.pipeline.index('CookHeaders')+1, 'DavidsHeader')
 >>>m.Save()
 >>>{Ctrl-D}

Your list will be processed with the additional handler that does 
nothing but add a header.

Alternatively you could also use the extend.py mechanism to add the 
header on a list-specific basis.


-- 
Jim Tittsler             http://www.OnJapan.net/      GPG: 0x01159DB6
Python Starship          http://Starship.Python.net/
Ringo MUG Tokyo          http://www.ringo.net/rss.html




More information about the Mailman-Users mailing list