Add default attachments to the EmailWebformHandler

Created on 31 October 2023, about 1 year ago
Updated 6 November 2023, about 1 year ago

We need a way to add default attachments to the mails send by the EmailWebformHandler. I will try to provide a patch.

✨ Feature request
Status

Closed: won't fix

Version

6.2

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dave.mentens

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dave.mentens
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    241 pass, 544 fail
  • @davementens opened merge request.
  • πŸ‡§πŸ‡ͺBelgium dave.mentens

    Patch to be used in your projects:

  • Status changed to Closed: won't fix about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    New features should be done via a contributed module. You can extend the EmailWebformHandler to create an EmailDefaultAttachmentWebformHandler.

    BTW, I am pretty sure you can use the Webform Attachment submodule to add default attachments to a submission and the subsequent email.

  • πŸ‡§πŸ‡ͺBelgium cgoffin

    @jrockowitz I helped Dave with this request and during our investigation we also looked at the Webform Attachment submodule. But we don't have an upload field on the webform. Our use case is that a user needs to fill in a webform in order to get the attachment via mail. The attachment isn't uploaded by the visitor. In the email handler you can add text for you mail message, but you can't add an attachment.

    We also had a look into extending and even decorating the EmailWebformHandler plugin, but decorating a plugin doesn't seem to work yet (see https://www.drupal.org/project/drupal/issues/2958184 β†’ ). Extending would mean that we have 2 different email handlers or alter the definition of the original plugin to use the extended class. We didn't like having 2 separate handlers only to be able to add an attachment and also wanted to avoid having problems with other modules extending.

    Because there is already a check to see if attachments are supported it seemed to be logical for us to add this functionality to the EmailWebformHandler plugin instead of extending.

    But what do you think that, for our use case, is the best approach?

Production build 0.71.5 2024