Recipe needed for sending ECA emails with Symfony Mailer

Created on 18 September 2024, 7 months ago

Problem/Motivation

I have been trying to find a way to get ECA to send html formatted emails using symfony mailer, with no luck. The following Bug did not result in a solution other than some vague suggestions to use Easy Email.

https://www.drupal.org/project/symfony_mailer/issues/3332684 ✨ Action to send HTML mails Needs work

However, I could not find any documentation with clear steps towards getting Easy Emails to work with ECA. I created the following ticket asking the Easy Email people for input, but thought I would cross post it here.

https://www.drupal.org/project/easy_email/issues/3475311 πŸ’¬ Recipe for sending ECA emails w/ Easy Email Active

Steps to reproduce

Proposed resolution

We need some step-by-step instructions detailing how to get ECA emails to send as html using swift mailer. This could use Easy Email, or perhaps it can be done without an additional module.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Active

Version

1.5

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States ezra

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

Comments & Activities

  • Issue created by @ezra
  • πŸ‡¬πŸ‡§United Kingdom adamps
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Well, ECA doesn't provide features as such. It makes existing features available to the modelling. That's also true for the generic send email action, which comes from Drupal core. But that doesn't support html. However, ECA can only always provide that functionality that is brought by the implementing module.

    In my experience, easy email is the best option available for Drupal these days. And that module requires at least 2 steps in an ECA model:

    • Create an email entity: provide a token name in which that email entity will be stored, you need that for the second step. In type you select the email template that you created before.
    • Send email: in that action you provide the token name that you used in the first step when you created the email entity. This will send the email with the settings from the easy email module, e.g. symfony mailer or smtp or otherwise.

    In between the 2 steps you can set field values of the email entity, if needed.

    Afterwards you can also save the entity, otherwise it will not be stored. But you don't have to.

  • Status changed to Fixed 4 months ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • πŸ‡¨πŸ‡¦Canada joelseguin Ontario, Canada

    This might be useful for some, the module maintainer of Easy Email has covered how to send out emails using ECA and Easy Email in a webinar. Here is the location in the video where he goes through this:
    https://youtu.be/2pjFr3cf9uw?si=IAUZd39dVMOz8o12&t=2426

  • πŸ‡«πŸ‡·France alex.amtr

    Hi,
    Thank you for your help, but I would like to set email destinator address dynamically in ECA. I don't understand how to do that.
    For exemple, I would like to send an email to my website members when they connect for the first time. It seems it is not possible to do it.
    Is it possible to set the "TO" field dynamically from ECA?

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    @alex.amtryou would add a entity reference field to a user entity to that email type and then you can add the current user to the email entity with ECA. As that email then knows that user, you get a token to that user's email address which can be configured in the TO field of the email.

  • πŸ‡«πŸ‡·France alex.amtr

    @jurgenhaas
    Thank you very much. I will try with your advice.
    Best regards,

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024