Add support for HTML email to Symfony Mailer plug-in

Created on 10 October 2023, about 1 year ago
Updated 19 October 2023, about 1 year ago

Problem/Motivation

Follow on from 📌 Add symfony/mailer into core RTBC . Add support for HTML mails, creating an email twig template.

Proposed resolution

The code can mostly be copied from swiftmailer module.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component
Mail 

Last updated 1 day ago

No maintainer
Created by

🇬🇧United Kingdom adamps

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

Comments & Activities

  • Issue created by @adamps
  • Status changed to Postponed about 1 year ago
  • 🇨🇭Switzerland berdir Switzerland

    I'm not convinced this is necessary.

    Yes, HTML support is very important, but the mailer we add is more or less just a proof of concept, if you need anything more than that, use a contrib module like the lite module.

    Supporting HTML isn't *that* trivial, it's not just about the wrapper template, but also the stuff about HTML conversion of the content so that links and basic HTML work.

    I'd say we should focus on the new mail API including HTML support.

  • 🇬🇧United Kingdom adamps

    but also the stuff about HTML conversion of the content so that links and basic HTML work.

    Yes absolutely, and I am aware of that as I already wrote code for it in swiftmailer😃. I would add 10-20 lines to SymfonyMailer::format() and I could write them in half an hour.

    I am content to reject this issue if that's the general opinion. But I raised it because I feel it would help progress on 🌱 [META] Adopt the symfony mailer component Needs review . The major challenge with this initiative is that it's too big a change to make in one commit. So we need to break it into pieces, yet each piece tends to have a dependency on the other pieces. If we can get the HTML template agreed here I see that as an advantage. As you pointed out in a comment somewhere else, it will likely attract a load of bike-shedding😃.

    The Lite module servers an important purpose, but also it has a lot of legacy code, so a clean Core alternative could be useful.

  • 🇬🇧United Kingdom adamps

    In clarification/summary: I updated 🌱 [META] Adopt the symfony mailer component Needs review to increase the emphasis on Stage 1 (@Mail plug-in).

    1. I believe we could make some useful progress, that would help Stage 2 (new mail service). For example in this issue we could introduce a config option for HTML/plain that we then re-use in stage 2.
    2. The issues in stage 1 are simple and self-contained. I can already mostly imagine what the patch would need to contain.
    3. Hopefully that makes them easy to commit

    However I'm very open to entirely revising that. Basically I think we need the Core committers to tell us what sort of thing they are willing to commit. It would be great to get something into 10.2 and time is starting to run out.

  • Status changed to Active about 1 year ago
  • 🇨🇭Switzerland berdir Switzerland

    > I would add 10-20 lines to SymfonyMailer::format() and I could write them in half an hour.

    I'm sure you can, but we both know that the amount of time it takes to write the code is usually only a small fraction of what it takes to get something into core.

    Getting an HTML template for mails into core sounds like a _major_ opportunity for bikeshedding about how that should look like exactly. There's the stuff about the stable and starterkit themes, how to manage the CSS in that file, maybe even the mail theme problem, ...

    For me, it's more important that core makes it easy to provide/have/use HTML mails in the new API and that we think about how to manage that there, and less about actually having an HTML template.

    But that's just my opinion, if we do get that in core that would be great and I'm definitely not going to block that or anything, I'm just not sure it's the most useful way to spend our/your time on.

  • 🇬🇧United Kingdom adamps

    Getting an HTML template for mails into core sounds like a _major_ opportunity for bikeshedding about how that should look like exactly. There's the stuff about the stable and starterkit themes, how to manage the CSS in that file, maybe even the mail theme problem, ...

    Exactly. That's why it could be useful to get it done here and now, in an issue that's simple and changes only 10 other lines of code, rather than as part of an issue that's already big and complex.

    I'm just not sure it's the most useful way to spend our/your time on.

    Well I'm not necessarily volunteering😃 (although I'm happy to spend the half hour writing those 10 lines of code). Probably there are 100s of people better than me to get the HTML template right.

    Likewise, I'm just offering an opinion. If the community prefers to reject this, that's fine by me.

Production build 0.71.5 2024