Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have some internal mailman mailing lists on my intranet. The company domain name has changed.

Can I automate the process of resigning 'user@old-domain.com' and assigning 'user@new-domain.com' from/to the list?

I have 11 lists, the busiest one has 17 members. So, not huge, but a huge pain to deal with manually.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Mailman has many commands to dump information and manipulate the lists. These are the commands that should be relevant if you are asking how to change the subscribed addresses of users from one domain to another.

  • list_lists - display all the lists
  • list_members - display the members of a list, can be redirected to a text file.
  • add_members - add members to a list, can take a file as input
  • remove_members - remove members from a list

Given those commands you should probably be able run through a simple process described by this psuedo shell code. You'll obviously want to clean this up to actually work and test it first. I don't have a system available at the moment I can test on.

for each list in `list_lists`
  # add members with new addresses
  add_members --welcome-msg=n --admin-notify=n \
   --file <(list_members {listname} | grep '@old-domain.com' | sed -e 's/old-domain.com/new-domain.com/') {listname} 
  # remove old addresses
  remove_members --file=<(list_members {listname} | grep '@old-domain.com') {listname}
share|improve this answer
    
Thanks - I need to find some time to re-visit this which won't be for a day or 2 now. Hopefully I'll be able to accept your answer then :-) –  dr-jan Aug 9 '11 at 17:39

Using Zoredache's excellent suggestions, I ended up processing each list in 3 stages, one for regular members and one for digest members, then a final pass to remove the old addresses. So, for each list I did this:

PATH=$PATH:/usr/lib/mailman/bin; export PATH

list_members --regular list_name | grep '@old_domain.com' | sed -e 's/old_domain/new_domain/' | add_members --welcome-msg=n --admin-notify=n --regular-members-file=- list_name
list_members --digest  list_name | grep '@old_domain.com' | sed -e 's/old_domain/new_domain/' | add_members --welcome-msg=n --admin-notify=n --digest-members-file=- list_name
list_members list_name | grep '@old_domain.com' | remove_members --file=- --nouserack --noadminack list_name

The PATH statement is needed because the mailman binaries are in an uncommon directory (/usr/lib/mailman/bin on my Fedora system).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.