Hi, We use our own solution to set vacation auto-reply in SOGo. You can use the same every day with cron.

We set vacation directly in database:

SOGo has settings in one string (attribute c_defaults). We read this string to variable $json, change this sting and then update in database. Format of this string is 'easy' readable: '{...,"Vacation": {...},...}'

    public function getDataFromSogo($mail) {
        return $this->sogodb->query("SELECT c_defaults FROM sogo_user_profile WHERE c_uid = %s",$mail)->fetch();
    }

    public function updateDataInSogo($mail,$json) {
        return $this->sogodb->query("UPDATE sogo_user_profile SET c_defaults = %s WHERE c_uid = %s",$json,$mail)->fetch();
    }

Immediately after changes in database:

   systemctl force-reload memcached
   /usr/sbin/sogo-tool update-autoreply -p /etc/sogo/sieve.cred
    >/dev/null 2>&1

sogo-tool update-autoreply is called periodically at midnight by cron also. It is used to autoreply swith on/off.

S pozdravem

*Ing. Zdeněk Havránek*
vedoucí střediska automatizace a IT

*SEA - Chomutov, s.r.o.*
Tel.:+420 474 624 048, Mobil: +420 777 717 303
E-mail: havra...@sea.cz <mailto:havra...@sea.cz>, Web: www.sea.cz <http://www.sea.cz/>

Dne 21.05.2021 v 7:18 "J. Echter" (j.ech...@echter-kuechen-elektro.de) napsal(a):
I thought it only gets overriden if you enter mail options and click save, what you wouldn't do if you not there, so it should survive the off day at least.

Am 20. Mai 2021 18:19:14 MESZ schrieb Pierre Fumet <users@sogo.nu>:

    Thanks for your proposal,
    but that's not appropriate IMHO :
    - SOGo does not manage sieve via sogo.sieve file but in DB, so changes 
would be overrided soon
    - I'm looking for (the possibility of) a clean (eg. managed by SOGo) way of 
implementing this feature

    On 20 May 2021 at 16:59, from Jürgen Echter :

        Hi, maybe you can write a small bash script and run it with
        cron. #!/bin/bash DAYOFWEEK=$(date +"%u") if [[ ($DAYOFWEEK
        -eq 3) ]]; then grep -qsxF '{ vacation :days 1 :addresses
        ["your@mail.address"] text: I'm out of office.; }'
        /path/to/your/sieve/sogo.sieve || printf "{ vacation :days 1
        :addresses ["your@mail.address"] text: I'm out of office.; }"
        >> /path/to/your/sieve/sogo.sieve elif sed -i '{ vacation
        :days 1 :addresses ["your@mail.address"] text: I'm out of
        office.; }/d' /path/to/your/sieve/sogo.sieve fi untested :)
        Juergen Am Donnerstag, Mai 20, 2021 10:31 CEST, "Pierre Fumet"
        (p...@zdn.fr) <users@sogo.nu> schrieb:  Hi all, SOGo webmail can
        activate vacation auto-reply and schedule beginning and end
        for this activation. But would it be possible to schedule
auto-reply only one day each week, eg. on wednesday ?

--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
--
users@sogo.nu
https://inverse.ca/sogo/lists

--
users@sogo.nu
https://inverse.ca/sogo/lists

Reply via email to