It's really annoyed me that I can't create a list alias domain, like
lists.omnifarious.org and still be able to refuse mail to
[EMAIL PROTECTED]

So, I created a small patch to Mailman.MTA.Postfix that allows you to
specify a prefix to be applied to all virtually hosted lists that show
up in the omnifarious.org domain.

For example, I have set this prefix to 'mmlist_'.  This is what my
virtual-mailman file now looks like:

# STANZA START: list-name
# CREATED: Thu May 27 08:00:48 2004
[EMAIL PROTECTED]              mmlist_list-name
[EMAIL PROTECTED]        mmlist_list-name-admin
[EMAIL PROTECTED]      mmlist_list-name-bounces
[EMAIL PROTECTED]      mmlist_list-name-confirm
[EMAIL PROTECTED]         mmlist_list-name-join
[EMAIL PROTECTED]        mmlist_list-name-leave
[EMAIL PROTECTED]        mmlist_list-name-owner
[EMAIL PROTECTED]      mmlist_list-name-request
[EMAIL PROTECTED]    mmlist_list-name-subscribe
[EMAIL PROTECTED]  mmlist_list-name-unsubscribe
# STANZA END: list-name

And, here is what my aliases file looks like:

# STANZA START: list-name
# CREATED: Thu May 27 08:00:48 2004
mmlist_list-name:             "|/var/list-name/mail/list-name post list-name"
mmlist_list-name-admin:       "|/var/list-name/mail/list-name admin list-name"
mmlist_list-name-bounces:     "|/var/list-name/mail/list-name bounces list-name"
mmlist_list-name-confirm:     "|/var/list-name/mail/list-name confirm list-name"
mmlist_list-name-join:        "|/var/list-name/mail/list-name join list-name"
mmlist_list-name-leave:       "|/var/list-name/mail/list-name leave list-name"
mmlist_list-name-owner:       "|/var/list-name/mail/list-name owner list-name"
mmlist_list-name-request:     "|/var/list-name/mail/list-name request list-name"
mmlist_list-name-subscribe:   "|/var/list-name/mail/list-name subscribe list-name"
mmlist_list-name-unsubscribe: "|/var/list-name/mail/list-name unsubscribe list-name"
# STANZA END: list-name

Yes, people can still send to [EMAIL PROTECTED], but I
consider that an acceptable tradeoff since I'm now allowed a lot more
detailed control over my omnifarious.org namespace.

The parameter's name is POSTFIX_VIRTUAL_PREFIX, and it's expected to be
set in the mm_cfg file.  If there is no POSTFIX_VIRTUAL_PREFIX set, it
defaults to being blank, which gives you the original behavior for the
Postfix MTA.

Have fun (if at all possible),
-- 
The best we can hope for concerning the people at large is that they
be properly armed.  -- Alexander Hamilton
-- Eric Hopper ([EMAIL PROTECTED]  http://www.omnifarious.org/~hopper) --
diff -u -r2.22 Postfix.py
--- Mailman/MTA/Postfix.py	14 Sep 2003 04:41:32 -0000	2.22
+++ Mailman/MTA/Postfix.py	27 May 2004 14:01:37 -0000
@@ -79,10 +79,18 @@
 
 
 
-def _addlist(mlist, fp):
+def _addlist(mlist, fp, virt=False):
     # Set up the mailman-loop address
     loopaddr = Utils.ParseEmail(Utils.get_site_email(extra='loop'))[0]
     loopmbox = os.path.join(mm_cfg.DATA_DIR, 'owner-bounces.mbox')
+    # Arrange for the virtual prefix to be added if needed.
+    if virt:
+        try:
+            virt = mm_cfg.POSTFIX_VIRTUAL_PREFIX
+        except:
+            virt = ''
+    else:
+        virt = ''
     # Seek to the end of the text file, but if it's empty write the standard
     # disclaimer, and the loop catch address.
     fp.seek(0, 2)
@@ -109,11 +117,14 @@
     # Now add all the standard alias entries
     for k, v in makealiases(listname):
         # Format the text file nicely
-        print >> fp, k + ':', ((fieldsz - len(k)) * ' ') + v
+        print >> fp, virt + k + ':', ((fieldsz - len(k)) * ' ') + v
     # Finish the text file stanza
     print >> fp, '# STANZA END:', listname
     print >> fp
 
+
+def _addvirtlist(mlist, fp):
+    _addlist(mlist, fp, True)
 
 
 def _addvirtual(mlist, fp):
@@ -123,6 +134,12 @@
     # Set up the mailman-loop address
     loopaddr = Utils.get_site_email(mlist.host_name, extra='loop')
     loopdest = Utils.ParseEmail(loopaddr)[0]
+    # Set up the virtual prefix, if any
+    virt = ''
+    try:
+        virt = mm_cfg.POSTFIX_VIRTUAL_PREFIX
+    except:
+        pass
     # Seek to the end of the text file, but if it's empty write the standard
     # disclaimer, and the loop catch address.
     fp.seek(0, 2)
@@ -147,7 +164,7 @@
     for k, v in makealiases(listname):
         fqdnaddr = '[EMAIL PROTECTED]' % (k, hostname)
         # Format the text file nicely
-        print >> fp, fqdnaddr, ((fieldsz - len(k)) * ' '), k
+        print >> fp, fqdnaddr, ((fieldsz - len(k)) * ' '), virt + k
     # Finish the text file stanza
     print >> fp, '# STANZA END:', listname
     print >> fp
@@ -226,9 +243,11 @@
         lock.lock()
     # Do the aliases file, which need to be done in any case
     try:
-        _do_create(mlist, ALIASFILE, _addlist)
         if mlist and mlist.host_name in mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS:
+            _do_create(mlist, ALIASFILE, _addvirtlist)
             _do_create(mlist, VIRTFILE, _addvirtual)
+        else:
+            _do_create(mlist, ALIASFILE, _addlist)
         _update_maps()
     finally:
         if lock:

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Mailman-Developers mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-developers
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Reply via email to