Normalize for Symfony Mailer's nested data structure

Created on 24 June 2023, almost 2 years ago

Problem/Motivation

Currently this module normalizes the Content-Type header, but the service method that returns the message should normalize everything in the nested "params" array, to make it easier for other code to not worry about finding the necessary values in multiple places.

Proposed resolution

Before returning the $message value, copying anything in the params nested array up to the main level, unless the key is already in use there.

✨ Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada mandclu

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

Comments & Activities

  • Issue created by @mandclu
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update almost 2 years ago
    PHPLint Failed
  • @mandclu opened merge request.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    Do we really want to copy all the parameters to the top level? I think maybe we should just do the headers. That's the only thing that is missing with symfony mailer module. It's not adding its headers to the main part of the message array, which means we can't show them on the preview page. It's not adding them in params either, but at least the requested headers from the module that sent the email are there. We'll still be missing the default headers, since symfony mailer manages those internally, it seems. In any case, I'm not sure that all the other variables in params are appropriate to copy up. Swiftmailer did not do that, nor does symfony mailer lite, so this would be introducing new functionality here in the preview, rather than trying to fill in missing information.

  • πŸ‡¨πŸ‡¦Canada mandclu

    In my testing, the symfony_mailer module also puts the body and subject information into the params array, as well as some other variables which don't appear to be immediately necessary for preview function (which I was working on when I cam across this inconsistency).

    Here's a looking at the $message array when using symfony_mailer:

    Compare that with the $message array when using symfony_mailer_lite:

  • πŸ‡ΊπŸ‡ΈUnited States zengenuity

    Oh, okay. I see that the other parameters are there. I didn't think they were. Okay, this is good to merge, then, I think.

  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update almost 2 years ago
    Waiting for branch to pass
    • mandclu β†’ committed 1fa369d3 on 2.1.x
      Issue #3369746 by mandclu: Normalize for Symfony Mailer's nested data...
  • Status changed to Fixed almost 2 years ago
  • πŸ‡¨πŸ‡¦Canada mandclu

    Thanks, merged in. One other note is that I also encountered a situation where symfony_mailer had provided the body as a render array instead of a string of markup, so this code also includes a check for this and will render an array if it encounters one. Not sure if that's something that should be moved upstream to the service code that generates the $message array.

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

Production build 0.71.5 2024