Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

⚠️ 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.

Activity

Total releases
3
First release
Feb 2026
Latest release
1 month ago
Release cadence
12 days
Stability
67% stable

Release Timeline

Releases

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