Needs work
Project:
Mailer Plus (DSM+)
Version:
1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
24 Jan 2022 at 14:47 UTC
Updated:
4 Jul 2022 at 14:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #3
balis_m commentedComment #4
adamps commentedThis is currently documented as a restriction of Legacy mode.
I understand your motivation here, but I am reluctant. If we add this one field, then someone else will want another and so on perhaps without end. And the code we add will have restrictions - for example I expect that code will only work for a single reply-to address without a display name.
My preference would be to push forward adding more email builders in the Proxy mode, like you did for
UserRegistrationPasswordEmailBuilder. The documentation link explains various advantages, and it is a stepping stone to a native implementation.What do you think?
Comment #5
balis_m commented@AdamPS, at first, I thought that it could be better to do some fixes on LegacyMailBuilder, but I understand your motivation.
I've added the new WebformEmailBuilder to the existing merge request. Also, I've added an extra functionality to cancel the email sending.
Comment #6
adamps commentedGreat thanks for your work here.
I absolutely agree this is a good idea. I have added an issue for it #3262457: Cancel email sending with an explanation of what I think is the right way to do it. Please can you take a look and see what you think?
Great thanks. I suggest we resolve the above issue first then revisit here.
One review comment I noticed in my first quick look: I think it should include a
hook_mailer_bc_MODULE_alter()similar tosymfony_mailer_bc_mailer_bc_contact_alter()that will set the entity. This would allow configuring policy specific to a single web form.Comment #7
adamps commentedI would be very interested in your thoughts on #3262540: [META] Use Policy GUI even with back-compatibility please. Webform is a very good example, as almost all of the EmailBuilder duplicates Symfony Mailer policy.
Comment #8
balis_m commentedYour idea is good, but on each webform we can apply multiple email handlers with whole different settings. How could we implement that?
Comment #9
adamps commentedAh I see what you mean. I never used webform and didn't realise how complex the configuration is.
So the next step here is to integrate #3262457: Cancel email sending and apply the comment from #6.
Comment #10
adamps commentedFYI I have reconsidered on the matter of the legacy email builder if you are interested in that: #3262946: Add support for more headers on legacy emails
Of course let's still keep this new EmailBuilder in any case.
Comment #11
balis_m commentedI have made the appropriate changes to skip the email sending.
It is not necessary as users can add multiple email handlers (with different body, sender etc.) on each webform. Also, the webform_submission entity is not an instance of ConfigEntityInterface.
Great, I think that it will be really useful to include more headers.
Comment #12
adamps commentedGreat thanks
I do think it will be useful to allow per-webform Symfony Mailer policy. It has functions not available in webform (transport, theme, skip sending, ...) and also some sites might prefer to keep the policy in a single place.
I'm not familiar with the code, however the entity I had in mind from a quick look was
Drupal\webform\Entity\Webform. It's similarly for contact module: the entity is ContactForm rather that Message.Comment #13
adamps commentedComment #14
balis_m commentedI have made some of the suggested changes.
I understand your motivation, but I think that the approach that we have now is clear and more flexible.
We can add mailer policy for each webform email handler by adding an underscore-separated string with the webform id and the webform email handler id. In example, to override the webform email handler with id email_confirmation on webform with id contact, we add the value contact_email_confirmation to the syb_type textfield. (screenshots attached)
Comment #15
rajab natshahThank you, Balis and Adam for working on this new feature issue
Testing to apply the MR in a site ( with the back-compatibility module )
But I'm facing the following error, right after applying the 13.patch
Should this only work when the back-compatibility module is off?
Comment #16
balis_m commented@AdamPS I have made some improvements.
Now, the webform sub-types are provided dynamically. Unfortunately, users have to clear all caches after adding/removing webforms/handlers.
Also, I have setted all the webform variables in the email template. So, from mailer policy, users can override the email body and subject too.
@Rajab Natshah This works when the back-compatibility module is on.
Could you please install the latest dev version, apply the patch https://git.drupalcode.org/project/symfony_mailer/-/merge_requests/13.diff, disable symfony_mailer/symfony_mailer_bc and enable them again?
Comment #17
adamps commentedGreat thanks for the updated patch. webform is a pretty complex example so it's a very useful testing ground for symfony mailer. I feel very comfortable with the direction this patch is heading - integrating with symfony mailer where possible yet also being pragmatic where needed.
Great idea
I guess that might cause confusion. Perhaps we would ideally use the entity API to do it automatically.
Also see comments in the review. Many thanks.
Comment #18
adamps commentedOK, I think I've got a much better idea.
symfony_mailer_bc_mailer_builder_info_alter().Email::appendBodyEntity()instead ofsetBody().What do you think??
Comment #19
david.qdoscc commentedI hope you don't mind me suggesting that until this is fixed you add a fairly prominent warning on the project page explaining that there are currently compatibility issues with Webform (reply to, cc, bcc etc). Webform is one of the most widely installed contrib modules, and with the expectation that symfony mailer is a straightforward swap-out for swiftmailer, this issue is likely to catch a lot of people out.
Comment #20
adamps commentedEventually yes. But this module is currently an alpha, and not ready for live use. I realise that people are using it anyway because swiftmailer is unsupported. Possibly many modules won't work, not just webform and there is already a documentation page dedicated to that linked from the project page. I've updated the project page generally to make this clearer.
Comment #21
adamps commentedSince #3262946: Add support for more headers on legacy emails Webform should work much better without this issue. Please can someone test? Currently requires the dev release.
This issue should stay open for the next level, an EmailBuilder will give significant advantages.
Comment #22
hchonovI can confirm that this issue does not exist with the current alpha 10 release.
Comment #25
grimreaperHi,
I am trying to send webform attachment with Symfony Mailer.
So I have created a new MR, rebased against last dev branch to test it.