- Issue created by @dave.mentens
- last update
about 1 year ago 241 pass, 544 fail - @davementens opened merge request.
- Status changed to Closed: won't fix
about 1 year ago 12:07pm 31 October 2023 - πΊπΈ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?