Delete Mails in public folder automatically by script ?

  • Good morning,

    we use an UCS System with kopano for our developers and their test-Emails.
    To make these mails available for everyone we use public folders.
    After 6 months we have over 500k Emails in one folder. Now we’d like to delete all mails until the last 30 days.
    I found the script, but as far as I understood it only deletes Mails in the junk and recycle-bin folder.

    Is there another possibility delete mails in public folders automatically by script.

    best regards

  • HI @AnotherAndy ,

    I faced the same issue a few days ago and, on the same site you found that script, there is another that does what you want.

    Please see:


  • great! @jasgggit Thanks! :-)

  • Kopano

    @AnotherAndy that scripts is by default not fixed to a specific folder, but will instead delete all messages of a give user. this is something you should be aware of.

  • @fbartels thanks - I used the dry-run parameter and it’s only a development system. But thanks for the info

    sure you cleandup public folders with this script?

    If i try it:
    python -u test-mails --from 2018-01-01 --until 2019-03-30 --dry-run
    Runnig for user test-mails
    Search items in Calendar
    Search items in Contacts
    Search items in Conversation Action Settings
    Search items in Deleted Items
    Search items in Drafts
    Search items in Inbox
    Search items in Journal
    Search items in Junk E-mail
    Search items in Notes
    Search items in Outbox
    Search items in Quick Step Settings
    Search items in RSS Feeds
    Search items in Sent Items
    Search items in Suggested Contacts
    Search items in Tasks

    Deleted items :0


    It looks like its just going into the mailbox, but not in de public folder associated with this user.

  • Hi @AnotherAndy @fbartels

    Sorry for the quick post, as it seems I haven’t analyzed well the question, and just wanted to provide a quick response. Need to pay more attention to this, note to myself.

    @fbartels - Thank you to point that out.

    @AnotherAndy , yes, I used the script to clear ALL emails up to a certain data, and it was the only one that worked for me, to accomplish this task, but I don’t use public folders, so my as I said, I thought it would do it.


Log in to reply