Koozali.org: home of the SME Server

ezmlm - How can I change the domain name of a list?

Offline holck

  • ****
  • 317
  • +1/-0
ezmlm - How can I change the domain name of a list?
« on: September 13, 2012, 05:05:34 PM »
My SME server hosts several domains, and now I want to change an ezmlm mailing list from one of these domains to another. That is, I have a list like mylist@myfirstdomain.org, and now I want to change the list to be mylist@myseconddomain.org, both domains hosted on the same server, same IP address. Ideally, I would like the list to respond to both addresses.

I have searched a lot, but cannot find any explanations on how to do this... Any suggestions?

Jesper, Denmark
......

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: ezmlm - How can I change the domain name of a list?
« Reply #1 on: September 14, 2012, 02:47:50 AM »
Hello Jesper,

Code: [Select]
db accounts show MyMailingList
MyMailingList=mailinglist
    Description=My description
    Domain=MyDomain.com
    Owner=admin


i guess that a

Code: [Select]
db accounts setprop MyMailingList Domain MyDomain2.comwould be a first step.

and maybe a
siganl-event mailinglist-modify MyMailingList



i have checked both qpsmtpd and qmail configuration, and they all appears to accept all domains configured (qpsmtpd) or at least not to filter them(qmail).


If it is not enough, then i guess you will have to do a sed s/MyDomain.com/MyDomain2.com/g to do in all files directory /home/e-smith/files/ezmlm/lists/MyMailingList and also in /home/e-smith/files/ezmlm/@.qmail-MyMailingList

and also in /home/e-smith/files/ezmlm/lists/MyMailingList/text folder

as usual backup before, and try it on a test mailing list first.
« Last Edit: September 14, 2012, 02:55:25 AM by unnilennium »

Offline holck

  • ****
  • 317
  • +1/-0
Re: ezmlm - How can I change the domain name of a list?
« Reply #2 on: September 14, 2012, 09:55:19 AM »
Thanks, unilennium, it seems to work :-)

Just a few improvements... you should do this:

Code: [Select]
for f in /home/e-smith/files/ezmlm/lists/MyMailingList/* ; do sed -i s/MyDomain.com/MyDomain2.com/g $f; doneand
Code: [Select]
for f in /home/e-smith/files/ezmlm/lists/MyMailingList/text/* ; do sed -i s/MyDomain.com/MyDomain2.com/g $f; done
The -i switch to sed edites the files "in place", and keeps ownership and access rights.

Thanks,
Jesper
......

Offline Jean-Philippe Pialasse

  • *
  • 2,763
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: ezmlm - How can I change the domain name of a list?
« Reply #3 on: September 14, 2012, 06:20:30 PM »
I will add this to the wiki !

thanks Jesper for sharing with us your work, after i helped you a little to point in the right direction.

can you confirm your mailing list is up to date and running with the new domain ?

Offline holck

  • ****
  • 317
  • +1/-0
Re: ezmlm - How can I change the domain name of a list?
« Reply #4 on: September 15, 2012, 03:21:59 PM »
I have not done a thorough test, but I believe it is mostly ok. One problem with my suggestions in my last post, is that it also tries to edit logfiles etc. So I have come up with a small, and, I think, better script:
Code: [Select]
#! /bin/sh
read -p "Please enter name of existing mailing list: " list
olddomain=`/sbin/e-smith/db accounts getprop $list Domain`
echo ".. and the new domain name as one of the following:"
/sbin/e-smith/db domains keys
read -p ".. new domain name: " newdomain
echo "Changing mailing address for list $list"
echo "from $list@$olddomain"
echo "to   $list@$newdomain"
read -p "OK? (y/n) " yn
if [ "$yn" != "y" ]
 then
 echo "Exiting ..."
 exit
fi
/sbin/e-smith/db accounts setprop $list Domain $newdomain
/sbin/e-smith/signal-event mailinglist-modify $list
for f in config editor owner bouncer mailer moderator headeradd prefix listid inhost outhost
do
  file = "/home/e-smith/files/ezmlm/lists/$list/$f"
  [ -a $file ] && sed -i.bak s/$olddomain/$newdomain/g $file
done
for file in /home/e-smith/files/ezmlm/lists/$list/text/*
do
  sed -i.bak s/$olddomain/$newdomain/g $file
done
......