Email - AD wide bulk changes

activedirectory
v7
mailserver
webtop5

(Klaus Boehme) #1

Is there a way to set email aliases and the default From sending domain for ALL Users in bulk?

I know I can do this on a user by user basis:

  • Configuration / Email / Create New Domain;
  • Management / Email Addresses / Mail Aliases;
    and then in Webtop:
  • User / Settings / Personal Information / Email.

but I’d like to be able to do this in Bulk via database or import script etc.

I have a server running AD/file share/nextcloud nicely in a local environment using the (non external qualified) ‘company.lan’ with some 30+ users configured. We are now looking at utilising email via webtop. I have added a fully qualified domain company.com.au and email delivery internal and external is working fine once the above changes are made to individual users.

The prospect of changing them all individually is a little daunting so direction for a script of sorts would be appreciated.

Thanks.

Klaus

NethServer Version: 7.4.1708
Module: webtop


(Markus Neuberger) #2

Hi @KdB,

there is an import script for the mail aliases:

http://docs.nethserver.org/projects/nethserver-devel/en/v7/nethserver-sssd.html?highlight=mail#import-emails

[root@server ~]# cat testuser.tsv
testuser        testuser@blabla.bla

[root@server ~]# /usr/share/doc/nethserver-sssd-1.3.3/scripts/import_emails testuser.tsv
[INFO] imported testuser@blabla.bla

EDIT:

You may change Webtop email for a user in database:

[root@server ~]# su - postgres -c 'psql webtop5'
psql (9.2.23)
Type "help" for help.
webtop5=# UPDATE "core"."users_info" SET "email"='testuser@blabla.bla' WHERE "user_id"='testuser' AND "domain_id"='NethServer';
UPDATE 1

(Luca Gasparini) #3

If you need to change the Emails of all users you can use this query:

UPDATE "core"."users_info" SET "email"=user_id||'@newdomain.ext' WHERE "domain_id"='NethServer' AND user_id not in ('admin');

To activate recommend a restart of tomcat:

systemctl status tomcat@webtop

All email addresses will be set up with user_id@newdomain.ext excluding admin


(Klaus Boehme) #4

Thank you Gentlemen. Solutions work well.

The only ‘glitch’, unless I’m missing something, is that there are no user entries (to update) in the webtop5 DB until the user has logged in first time.

It would be nice to have a ‘default’ entry added to that DB as a system user is created.

Thanks,

Klaus


(Luca Gasparini) #5

Hi @KdB,
if you want to enable every single profile without first logging in, you can do so via the WebTop 5 administration interface:

Domains -> NethServer -> Users
Double click on each user -> then save & close button

Users with the created profile will have a green icon on the right


(Klaus Boehme) #6

Thanks Luca. I missed that earlier.