Mass update of webmail sys across different users, mail domains

I know where to change a mail domain from eg roundcube to snappymail within the web interface.

I have a large number of these to do, and was wondering if there was a v-command to do it, so I could script it. I have checked out all the likely commands and they don’t seem to do what I want. In fact, I’ve probably spent longer looking through v-commands that it would take me to actually do them all manually!

Anyway, just curious now, where the command is to do this. I see the data in $HESTIA/data/users/user/mail.conf

Could I just run sed on those and then v-rebuild-mail-domain? Or is there a neater way.

1 Like

Doh! Just found it …
v-add-mail-domain-webmail user domain.com snappymail

So I might as well include the hacky script to convert all mail domains on a server.

#!/bin/bash

for USER in $( v-list-users plain | awk ‘{print $1}’ )
do
  for DOMAIN in $(v-list-mail-domains $USER plain | awk ‘{print $1}’)
  do
   echo “v-add-mail-domain-webmail $USER $DOMAIN snappymail”
  done
done

That will print out the commands. You can remove the echo and double quotes to directly run them.

2 Likes