No announcement yet.

Deleting emails and their attachments

  • Filter
  • Time
  • Show
Clear All
new posts

  • Deleting emails and their attachments


    We are trying to delete some old emails and their attachments, since they are taking a lot of space. But we encountered a few problems:
    1. We want to keep emails that were sent or received by certain email accounts.
    2. Deleting emails in Espocrm itself does not delete them from the database instantly and as I understand if you set 'Clean up deleted records' to true, it only deletes them after 90 days. Is there anyway to change this setting, so it deletes the records faster or instantly from the database also?
    3. Also if we delete the emails and clean the deleted records, will it also remove the associated attachments that are stored in the file system?

  • #2
    Hello Mark
    You can remove emails directly from database. You can also create custom cleanup script which will don't wait X days.
    Yes, if attachment is not related to anything, then cleanup should also remove attachments.

    You can also create your own job which will take X mails per minute and remove them only if they meet conditions. Then you can use this command to remove them from database immediately -


    • #3
      Hi, simply create a scheduled job with a condition you want emails to be deleted and run every 24 hours for example. I would not go under 24 hours (12 hours, 1 hour), because that is extremely unnecessary. Best logic I would recommend - "Every 24 hours, delete all emails, that are {condition}"