Attached is a pythonfilter which will log the original recipient address
for messages that are delivered to aliases. It took less than 5 minutes
to write. :)
Virtually anything that you want logged could be done in a very similar
fashion.
#!/usr/bin/python
# log_aliases -- Courier filter which logs the original address of messages
deliverd to aliases
# Copyright (C) 2008 Gordon Messmer <[EMAIL PROTECTED]>
#
# This file is part of pythonfilter.
#
# pythonfilter is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pythonfilter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pythonfilter. If not, see <http://www.gnu.org/licenses/>.
import sys
import courier.control
def initFilter():
# Record in the system log that this filter was initialized.
sys.stderr.write('Initialized the "log_aliases" python filter\n')
def doFilter(bodyFile, controlFileList):
for addr in courier.control.getRecipientsData(controlFileList):
if addr[1]:
if(addr[1].startswith('rfc822;')):
addr[1] = addr[1][7:]
sys.stderr.write('Message delivered to %s was originally addressed
to %s\n.' % \
(addr[0], addr[1]))
return ''
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users