Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

This module automatically deletes uploaded Webform attachment files from your private file storage after the last email handler has processed a submission. It helps keep your private file system clean by removing temporary files specific to each Webform submission.

⚠️ Warning !!! This module will delete files under your private file system so do use with caution and backup your website before testing

Cleans up uploaded webform attachment files from the private file directory after the last email handler sends. This avoids leaving temporary files in private://webform/<webform-id>/ after emails are delivered.

Requirements

  • Drupal 10 or 11
  • Webform
  • Private file system configured (for cleanup to run)

Configuration

  1. Go to Structure → Webforms → Webform email cleanup (path: /admin/config/content/webform-email-cleanup).
  2. Check the webforms for which attachment files should be deleted after the last email handler sends.
  3. Save configuration.

Only the last email handler (by weight) that is triggered for the current submission (i.e. not disabled and conditions pass) runs the cleanup. If you use conditional logic on handlers, only handlers that actually run for that submission are considered.

How it works

  • The module replaces the core Webform email handler with an extended version (same plugin ID email).
  • After sendMessage() runs successfully, if the current handler is the last triggered email handler for the webform and the webform is in the cleanup list, it deletes the contents of private://webform/&lt;webform-machine-name&gt;/.
  • Files and subdirectories in that path are removed. The directory itself may remain. Cleanup is logged and errors are reported via the logger and (when applicable) the messenger.

Notes

  • Private files: Cleanup only runs when the private file system is configured. If it is not, a warning is logged and no files are deleted.
  • Plugin override: Enabling this module replaces the default Webform email handler. Clear cache after enabling so the override is applied.
  • Managed files: This module removes files from the filesystem under the webform's private directory. It does not delete managed file entities from the database; ensure your workflow does not rely on those files remaining on disk after the last email is sent.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Feb 2026
Latest release
5 months ago
Releases (12 mo)
3 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.0.1 Stable 10–11 Mar 5, 2026
1.0.0 Stable 10–11 Feb 10, 2026
1.0.x-dev Dev 10–11 Feb 10, 2026