Of I forgot for setting instead of putting the value in the command line you
can write the json in a file and do:
sogo-tool user-preferences set defaults <user> Forward -f <file> -p
<credfile>

Quentin

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of qhivert
Sent: jeudi 5 octobre 2023 15:38
To: [email protected]
Subject: RE: [SOGo] documentation for sogo-tool

I see, as the doc is not yet ready, I will explain it:

To see if a user has a forwarding rule:
sogo-tool user-preferences get defaults <user> Forward
result:
Forward:
{"forwardAddress":["[email protected]"],"enabled":1,"keepCopy":1}
Or can be:
Value for key "Forward" not found in defaults If Forward have never been
set.

-----

To unset a forwarding rule:
sogo-tool user-preferences unset defaults <user> Forward -p <credfile>

credfile is a simple one-line file that contains "username:password" of an
admin account of your imap/cyrus server.

-----

To set a forwarding rule:
sogo-tool user-preferences set defaults <user> Forward <values> -p
<credfile>

values is a json-string as such:
 
{"forwardAddress":["[email protected]"],"enabled":1,"keepCopy":1,"alwa
ysSend":1}
* forwardAddress: string array of mails where to forward to
* enables: 0/1, 1 to enable 0 to disable the rule
* keepCopy: 0/1, 1 to keep a copy, 0 to not
* alwaysSend: 0/1, 1 to put the forwarding rule at the top of you sieve
script (so no other filters will be applied before), 0 to put it at the
bottom.
keepCopy and alwaysSend are optional cand will be 0 if missing.

Example:
sogo-tool user-preferences set defaults sogo-tests1 Forward
'{"forwardAddress":["[email protected]"],"enabled":1,"keepCopy":0}' -p
cred

-----

VoilĂ ! I've test it on my machine but let me know if you have trouble with
it or if there is unexpected behavior. The order of arguments is very
important.

Quentin

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Marco
Sent: jeudi 5 octobre 2023 13:48
To: [email protected]
Subject: Re: [SOGo] documentation for sogo-tool

Am 05.10.2023 schrieb "qhivert" ([email protected]) <[email protected]>:

> There is no documentation yet but it's in our short todo list.
> For now, you can have more information for each command by typing:
> sogo-tool <command>
> without any arguments.

Thanks for that suggestion, but that doesn't display all options.

[root@sogo ~]# sogo-tool user-preferences user-preferences get|set|unset
defaults|settings user [-p credentialFile] key [value|-f filename]

     user              the user of whom to set the defaults/settings
     key/value value             the JSON-formatted value of the key

  -p credentialFile    Specify the file containing the sieve admin
  credentials The file should contain a single line:
                         username:password
  Examples:
       sogo-tool user-preferences get defaults janedoe SOGoLanguage
       sogo-tool user-preferences unset settings janedoe Mail
       sogo-tool user-preferences set defaults janedoe SOGoTimeFormat
       '{"SOGoTimeFormat":"%I:%M %p"}'

I am interested in changing the forwarding rules via sogo-tool.


Reply via email to