Author Topic: How to delete email older than a certain date  (Read 1833 times)

opensauce

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
How to delete email older than a certain date
« on: May 14, 2018, 01:59:11 pm »
We are using Zentyal 4.2.12 with SOGO.
In order to comply with GDPR we are wanting to delete all email older than a certain date e.g. 5 years. I have a couple of questions.

1. Where is email stored with SoGO?
2. Is there a way to delete email older than a set date using a script?

Many thanks for your help.

half_life

  • Bug Hunter
  • Zen Hero
  • *****
  • Posts: 867
  • Karma: +59/-0
    • View Profile
Re: How to delete email older than a certain date
« Reply #1 on: May 29, 2018, 06:00:36 am »
Contacts and calendar are stored in mysql.  The mail info is in maildir format under /var/vmail/<your_domain>/username/Maildir/. Folders created within SOGo are hidden.  The file dates should be enough but you could also parse the date info in the email.

You can find all candidate emails with something like this:
Code: [Select]
find /var/vmail/<your_domain>/* -type f  -mtime +1825

Adding a -delete to the end will perform the deletion.