Kopano rules mark mail as "seen"



  • Hi,

    how can i mark mails as seen, when it will be moved to a subfolder?

    Jan


  • Kopano

    Hi @jn ,

    do you mean “mark a mail as seen, when it will be moved to a subfolder by a rule”? Currently there is no option in WebApp to have “mark as read” as an option.



  • Hi,

    yes i want the moved mail mark as read/seen - and i know, there is no option in the web app. Therefore my question, how can i do that?
    Maybe with a script in the shell, that mark all maila in a subfolder as seen/read !?

    Jan


  • Kopano

    Hi @jn ,

    you can find the scripting reference for python kopano at https://documentation.kopano.io/kopano_python_kopano/



  • Hi,

    how can i trigger such script, if new mail will be processed?
    and … this script does not work:

    #!/usr/bin/python
    import kopano
    server = kopano.Server()
    store = server.user('jn').store
    box = store.folder('Inbox/admin')
    count = box.count
    print(count)
    for item in box:
        if not item.read:
            print(item.read)
            item.set_value("read", true)
    

    i got this error:

    # ./jnm.sh
    86
    False
    Traceback (most recent call last):
      File "./jnm.sh", line 18, in <module>
        item.set_value("read", true)
    AttributeError: 'Item' object has no attribute 'set_value'
    

    Jan


  • Kopano

    Hi @jn ,

    not much of a python developer myself, so I cannot directly help on the issue. will forward it internally to see if someone can spot the error.

    If you want immediately execute an action if a folder has changed, then we have a mechanism called incremental change system (ics). For an example of it you can look at kopano-search or the kopano-spamd script.



  • Hi Felix,

    thx for your answer.
    So i will wait until you get an info from the python developers, because, everything i had tried resolve to the error above.

    I will try to use the ics … but, i think it is suboptimal, to parse all mails in a folder to catch the one, who is unread.
    Sometimes, a folder could contain thousends of mails. Maybe your developer has a better method then my script above.

    Jan



  • @jn said in Kopano rules mark mail as “seen”:

    ./jnm.sh

    86
    False
    Traceback (most recent call last):
    File “./jnm.sh”, line 18, in <module>
    item.set_value(“read”, true)
    AttributeError: ‘Item’ object has no attribute ‘set_value’

    Just use:

    item.read = True
    

    Here is an example:

    >>> list(kopano.Server().user("user1").inbox)[0].read
    False
    >>> list(kopano.Server().user("user1").inbox)[0].read = True
    >>> list(kopano.Server().user("user1").inbox)[0].read
    True
    

    Bo



  • Hi,

    ok, thats easy. Very well.
    Is there a trigger, to start my script and use parameter (like Folder / Mail / …)

    Jan


Log in to reply