The following is my patch to tmda-rfilter to extract the address
extension from RECIPIENT_HEADER, rather than the EXT or EXTENSION
environment variables, if RECIPIENT_HEADER is set and the named header
exists.  This makes it easy to use tmda in situations where EXT isn't
set (eg, behind fetchmail).

It applies cleanly to 0.69.

Comments welcome.

Ed

--- bin/tmda-rfilter.orig       Thu Sep 26 20:18:26 2002
+++ bin/tmda-rfilter    Fri Sep 27 02:08:44 2002
@@ -167,8 +167,16 @@
 if envelope_recipient == None:
     raise Errors.MissingEnvironmentVariable('RECIPIENT')
 # EXT is the recipient address extension.
-address_extension = (os.environ.get('EXT')           # qmail
-                     or os.environ.get('EXTENSION')) # Postfix
+address_extension = None
+if Defaults.RECIPIENT_HEADER and recipient_header:
+  recip = recipient_header.split('@')[0]       # remove domain
+  if recip:
+    pieces = recip.split(Defaults.RECIPIENT_DELIMITER, 1)
+    if len(pieces) > 1:
+      address_extension = pieces[1]
+else:
+  address_extension = (os.environ.get('EXT')           # qmail
+                     or os.environ.get('EXTENSION'))   # Postfix

 # If SENDER exists but its value is empty, the message has an empty
 # envelope sender.  Set it to the string '<>' so it can be matched as

_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to