Ok so I have done some research into the problem of the email address that are either in the from: field of an email or appear in the body of an email (i.e. the new signup email) or an email address that appears in the admin pages (i.e. moderator request pages)
The from addresses can be resolved using postfix canonical maps. Simply put, creating the file:
/etc/postfix/canonical
and entering:
test_domain1.com@domain1.com test@domain1.com
test_domain1.com-bounces@domain1.com test-bounces@domain1.com
test_domain1.com-owner@domain1.com test-owner@domain1.com
etc
then running postmap /etc/postfix/canonical
This will resolve the from address problem but wont resolve the other problems.
All of the problems can be fixed by making some minor changes to mailman core files.
So far I have done 2 things:
-
written a script that changes the real_name to “test” and leaves the list_name as “test_domain1.com”
-
modified /usr/lib/mailman/Mailman/MailList.py to correct the email address generation code
1. Rename real_name
The reason why I have done this, is because Cpanel does it. It neatens up the UI as only “test” is displayed instead of “test_domain1.com”
See the attached python file. It was written and placed in the mailman bin directory next to “withlist”
/usr/lib/mailman/bin/rename_list.py
The command to run this script is:
cd /usr/lib/mailman/bin
./withlist -r rename_list test_domain1.com
2. Modify MailList.py
I am still checking for other lines of code that need changing and i’m 90% certain it isn’t yet perfect.
nor is it properly tested!
At approx line 190 I changed the getListAddress() function for this one:
def getListAddress(self, extra=None):
regex = re.compile('^(.*)_'+self.host_name+'$')
d = regex.match(self.internal_name())
#if the format of internal_name is test_domain1.com
#and the host_name is domain1.com then it is a special case
#correct the email address from test_domain1.com-extra@domain1.com
#to test-extra@domain1.com
if d is not None:
print d.group(1)
if extra is None:
return '%s@%s' % (d.group(1), self.host_name)
return '%s-%s@%s' % (d.group(1), extra, self.host_name)
else:
if extra is None:
return '%s@%s' % (self.internal_name(), self.host_name)
return '%s-%s@%s' % (self.internal_name(), extra, self.host_name)
This function should detect for listnames of the format name_domain and set the email address accordingly.
Other functions that need looking at that I think will need some modification are:
GetMemberAdminEmail()
GetConfirmEmail()
At this moment in time Option 2 does not correct the from: email addresses.
It will be in there somewhere though!
Mark
References:
http://www.gnu.org/s/mailman/todo.html (Virtual Domain Support is on the Mailman todo list!)
http://mail.python.org/pipermail/mailman-users/2008-January/059939.html (possible issue with the genaliases command)
http://mail.python.org/pipermail/mailman-users/2011-June/071708.html (change real_name)
https://support.mayfirst.org/ticket/249 (editing email templates)
http://www.mail-archive.com/mailman-users@python.org/msg37220.html (emailaddr variable in email templates)
http://manpages.ubuntu.com/manpages/maverick/man8/withlist.8.html (with list man page)
http://docs.python.org/howto/regex.html#regex-howto (regex expression guide)