This module adds a custom Artisan command to clean up conversations in FreeScout based on various criteria.
- Clean up conversations based on mailbox IDs, statuses, age, and subject patterns.
- Perform a dry run to preview the conversations that would be deleted without actually deleting them.
- Confirm deletion of conversations before proceeding.
- Download the latest module zip file here. Do not use the master branch! The master branch is not stable and should only be used for development purposes.
- Transfer the zip file to the server in the Modules folder of FreeScout.
- Unpack the zip file.
- Remove the zip file.
- Activate the module via the Modules page in FreeScout.
To use the cleanup command, run the following Artisan command:
php artisan cleanup:conversations [options]
Note
The cleanup command will not immediately delete conversations. It will prompt you to confirm the deletion of conversations before proceeding. If the --y
option is provided, the command will not prompt for confirmation and will delete
conversations immediately.
Available options:
--mailbox-id
: The IDs of the mailboxes to clean up conversations for (can be used multiple times).--status
: The statuses of conversations to clean up (1=active, 2=pending, 3=closed, 4=spam, can be used multiple times).--older-than-days
: Clean up conversations older than the specified number of days.--subject-starts-with
: Clean up conversations with subjects starting with the specified string.--subject-contains
: Clean up conversations with subjects containing the specified string.--subject-ends-with
: Clean up conversations with subjects ending with the specified string.--limit
: The maximum number of conversations to delete.--dry-run
: Perform a dry run without actually deleting conversations.--y
: Confirm deletion of conversations.
Examples:
- Clean up conversations older than 30 days:
php artisan cleanup:conversations --older-than-days=30
- Clean up closed conversations with subjects starting with "[RESOLVED]":
php artisan cleanup:conversations --status=3 --subject-starts-with="[RESOLVED]"
- Perform a dry run to preview conversations that would be deleted:
php artisan cleanup:conversations --mailbox-id=1 --mailbox-id=2 --older-than-days=90 --dry-run
- Remove all conversations that are older than 60 days and have the status spam or closed:
php artisan cleanup:conversations --older-than-days=60 --status=3 --status=4
- Remove all conversations that are older than 60 days and have the status spam or closed, but only if the subject starts with "SPAM":
php artisan cleanup:conversations --older-than-days=60 --status=3 --status=4 --subject-starts-with="SPAM"
- Remove all conversations that are older than 60 days and have the status spam or closed and limit the amount of conversations to delete to 10:
php artisan cleanup:conversations --older-than-days=60 --status=3 --status=4 --limit=10
Feel free to add your own features by sending a pull request.
Interested in a custom FreeScout module or anything else? Please let us know via [email protected] or www.ljpc.solutions.
This module took us time to develop, but we decided to make it open source anyway. If we helped you or your business, please consider donating. Click here to donate.