Yves Moisan wrote:
>
>- Parse the Subject line looking for "*rror*"
>- If so, send an email to an arbitrary address
[...]
>
>I understand the pipeline system and how I could add the Handler for a 
>specific list, but I'm looking for a detailed Python API listing 
>somewhere to see what I can really do in the process() function, e.g.
>
>def process(mlist, msg, msgdata):
>     subject = msg.getheader('subject')
># parse subject (I'll find that) and if error
>  #  msg.send("arbitraryem...@whatever.com")


The Mailman API is documented in the source.

You need something like

import re
from Mailman import Utils
from Mailman.Message import UserNotification
NTEXT = """The text of
the
notification.
"""
NRECIP = 'recipi...@example.com'
NFROM = 'sen...@example.com'
NSUBJ = 'Notification subject'

def process(mlist, msg, msgdata):
    subject = Utils.oneline(msg['subject'], 'us-ascii')
    if re.search('.*rror.*', subject, re.IGNORECASE)
        nmsg = UserNotification(NRECIP, NFROM, NSUBJ, NTEXT)
        nmsg.send(mlist)


-- 
Mark Sapiro <m...@msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

------------------------------------------------------
Mailman-Users mailing list Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Reply via email to