Outdated documentation

You are looking at the documentation for an older release. For the latest information, please see current release documentation.

Administrator Interface

This package has no administrator interface.

Note

This feature is only available to On-Premise customers. If you are a Managed customer, this feature is taken care of by the Customer Solutions Team in OTRS. Please contact us via support@otrs.com or in the OTRS Portal.

System Configuration

The package is not working out-of-the-box, it must be configured by an administrator first.

  1. Go to the System Configuration screen.
  2. Select OTRSDeleteAttachments in the Navigation widget.
  3. Navigate to Core → Ticket in the navigation tree.
  4. Add some file MIME types to setting OTRSDeleteAttachments::Filetypes as key-value pairs. The key is the MIME type, the value is the deletion flag.
    • 0: This type of attachments are not to be deleted.
    • 1: This type of attachments are going to deleted.
File Types Setting

File Types Setting

Automatic File Type Population

There is a console command Maint::Ticket::Attachment::AddMIMETypes to populate the system configuration setting automatically.

otrs> /opt/otrs/bin/otrs.Console.pl Maint::Ticket::Attachment::AddMIMETypes
Searching attachment types received the last 90 days...
|       Added undefined MIME type: application/x-yaml
|       Added undefined MIME type: image/png
|       Added undefined MIME type: text/html
|       Added undefined MIME type: application/pdf
|       Added undefined MIME type: text/plain
Updating SysConfig...
Done.

Note

The console command collects only MIME types of attachments, that are in closed tickets and received within the last 90 days.

Delete Attachments From Tickets

The attachment deletion is done by console command Maint::Ticket::Attachment::Delete. Check the following settings to customize the job:

OTRSDeleteAttachments::Queues

A list of queues (specified by their names) which are processed by the Maint::Ticket::Attachment::Delete console command.

Warning

If no queues are defined, all queues will be affected.

OTRSDeleteAttachments::TimeSpan
The starting time (in days) from the current date from which the tickets should be analyzed for deletion.
OTRSDeleteAttachments::TimePeriod
The end time (in days) from the current date up to which the tickets should be analyzed for deletion.

Example:

TimeSpan: 10
TimePeriod: 40
                           Eligible  tickets
              |=========================================|
                                                        |=============|
                            TimePeriod (40)              TimeSpan (10)
|-------------|-------------|-------------|-------------|-------------|
50 days ago   40 days ago   30 days ago   20 days ago   10 days ago   Today
                                                        |
                                                       \ /
                                                Ticket close time

Means that all tickets between 10 days ago from the current date and 40 days ago from the current date are analyzed for deletion.

Note

The value of TimePeriod must be always higher than the value of TimeSpan.

See also

The console command Maint::Ticket::Attachment::Delete has some other options. Run the command with the --help option to see the possibilities.

otrs> /opt/otrs/bin/otrs.Console.pl Maint::Ticket::Attachment::Delete --help

Automatic Execution

Updating the file types and deleting the attachments can be run in the background by the OTRS daemon. Enable the following settings to run the jobs in a regular basis:

Daemon::SchedulerCronTaskManager::Task###OTRSDeleteAttachments
Delete attachments from tickets.
Daemon::SchedulerCronTaskManager::Task###OTRSDeleteAttachments_AddMIMETypes
Populate system configuration MIME types for attachment deletion.

Note

Do not forget to restart the OTRS daemon after the system configuration is changed.