[Mailman-Users] Modify member address
Jim Tittsler
jwt at onjapan.net
Tue Sep 21 03:47:18 CEST 2004
On Sep 20, 2004, at 20:39, saravanan ganapathy wrote:
> Now I need to change my domain from a.z.com to z.com,
> Due to this effect, I have to change all of my
> member/owner addresses ( *@a.z.com to *@z.com).
You can change all of the members in a list using a tiny Python script
using the bin/withlist framework, and then use a shell script (or
another Python script) to loop over all of your lists.
If you create /usr/local/mailman/change_addr.py containing:
#---- change_addr.py ----
def change_addr(m):
old_addrs = []
for member in m.members:
if member.rfind("@a.z.com") > 0:
old_addrs.append(member)
for member in old_addrs:
m.changeMemberAddress(member, member.replace('@a.z.com',
'@z.com'))
# change the list owners' addresses
new_owners = []
for owner in m.owner:
new_owners.append(owner.replace('@a.z.com', '@z.com'))
m.owner = new_owners
# save the updated list
m.Save()
#---- change_addr.py ----
Then doing 'bin/withlist -q -l -r change_addr mylist' would change all
of the member subscriptions in 'mylist'. A shell loop to do it for all
of your lists:
for list in `bin/list_lists -b`; do
bin/withlist -q -l -r change_addr $list
done
(Leave off the -q to watch it in action.)
Confirming you have good backups of all your lists before doing any
manipulation with withlist is a good idea. :-)
--
Jim Tittsler http://www.OnJapan.net/ GPG: 0x01159DB6
Python Starship http://Starship.Python.net/
Ringo MUG Tokyo http://www.ringo.net/rss.html
More information about the Mailman-Users
mailing list