Closed (fixed)
Project:
Mailer Plus (DSM+)
Version:
1.1.0-beta3
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2022 at 14:48 UTC
Updated:
21 Feb 2023 at 02:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jungleComment #3
adamps commentedThanks.
The patch looks like a good start. I think we can simplify quite a lot - only 3 files need changing.
1) I don't think we need
WebformEmailBuilder. The requirement may be in other modules, not only Webform. SoLegacyEmailBuildershould handle it. We don't need$email->setParam('attachments'which I think is unused.2)
AttachmentEmailAdjusteris a good idea to provide some security/policy to check attachments. However it's not part of this patch instead we should have a separate issue.3) The
attach()method belongs inBaseEmailInterfaceandBaseEmailTraitalongside the existingattachFromPath().4) public function attach(string $content, ?string $name = NULL, ?string $mimeType = NULL);
Don't need the '?'. Let's call the parameter $body to match symfony.
Comment #4
adamps commentedComment #5
jungle@AdamPS, Many thanks for pushing this forward and thanks for the patch.
One point, is the order matters here? Should
!empty($attachment['filecontent'])go first? the original patch did that. I do not really understand the related logic behind it. But Let's take a generic case as an example of reading a file. The file content is read from a file path, and if the file content and file path are both set, later on, if the file content exists, the file path may not be reached.Comment #6
adamps commentedI copied the order from swiftmailer module, which seems best for compatibility between the two.
If someone could test this with WebFrom and confirm it works then I will commit. We're not far from a stable release now, and this issue should be in it.
Comment #7
jungleTested manually against a webform (a private one so that I won't post it here.), and the patch works for me. Thanks!
Comment #8
jungleFix typo in title
Comment #9
jungleClose #3321877: TypeError: Drupal\symfony_mailer\Email::attachFromPath()?
Comment #11
adamps commentedThanks
Comment #12
jungle