Module Isn't Working or Emails Sent as Plain Text

Created on 16 June 2024, 6 months ago
Updated 25 June 2024, 6 months ago

Hello, I've installed this module on a Drupal 10 website with Mail System already installed and enabled. As per the instructions, at /admin/config/system/mailsystem, I selected "Drupal Symfony Mailer Lite" for both the Formatter and Sender under 'Default Mail System. For 'Theme to render the emails', I left that at "Current".

I installed this module to solve this problem: https://drupal.stackexchange.com/questions/268379/why-wrap-lines-in-plai...
That is, the default Drupal site-wide contact form is sending e-mails as plain text, and Drupal is following an old standard that breaks lines of text after 78 characters.

Unfortunately, after doing the above and running a test, I'm still seeing the same formatting with my e-mails (see attached screenshot). I'm not sure if the module isn't working at all, or perhaps I'm missing something to enable HTML format (and so it's falling back to plain text).

In any case, I'm just trying to get the standard Drupal e-mails to display without such odd-looking line breaks in the e-mail text. I'll be happy to provide any further info. to help diagnose this and find a solution.

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jimmb

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

Comments & Activities

  • Issue created by @jimmb
  • πŸ‡ΊπŸ‡ΈUnited States jimmb

    As a 2nd test, I changed the 'Theme to render the emails' to "Claro" (which is the administration theme). After saving the changes and clearing all caches, I submitted another contact form entry.

    Again, it's displaying only as plain text and breaking the lines as before.

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

    Update: I've now removed this module and run some tests with only the Mail System module. And the e-mails still appear to be sent as plain text (i.e. the line breaks are still happening as before).

    So perhaps this is more of a problem with the Mail System module. As such, I've also created an issue on their project page, and added it here as a related issue.

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

    The Mail System maintainers helpfully replied, and made it clear that any such issues would be with this module. After that, I happened to (finally) stumble across and realize there is an additional GUI admin section for this module that I'd missed before...

    So here's where things are at now:

    1. At /admin/config/system/symfony-mailer-lite/transport, I added the 'Sendmail' Transport type and made it the default. I otherwise left all settings as is.

    2. At /admin/config/symfony-mailer-lite/message-settings, I changed the 'Default Content Type' to "HTML". I left 'Always use the default content type' as unchecked. For 'Text format', I left that as "Plain text". For 'Plain Text Version', I left the option there as checked. And for 'Character Set', I left that as "UTF-8".

    3. At /admin/config/system/symfony-mailer-lite/test, I then sent a test e-mail. It was received at an Outlook account, and says the module has been successfully configured. The text here also spans across the full width of the computer screen, so that looks great and I assume indicates it's sending as HTML

    4. Next I went to the website's contact form and submitted it, but unfortunately I'm still seeing the same plain text line breaks on both e-mails. So I flushed all caches, and tried again. But to my dismay, I'm still seeing the e-mails as plain text. For what it's worth, the auto-reply e-mail is being sent to an account on mail.com, and the e-mail notification message is sent to a Gmail account.

    Note also that I have set up SPF and DKIM for the website, and have already verified that these are in place with the contact form's e-mails.

    I suppose the only other note is how things are set up currently on the Mail System page:

    Default Mail System: Formatter and Sender are set to: Default PHP Mailer
    Theme to render the emails: Current

    Under 'Module-specific configuration', the following are set:
    Module=Drupal Symfony Mailer Lite, Key=All, Formatter=Drupal Symfony Mailer Lite, Sender=Drupal Symfony Mailer Lite
    Module=Contact, Key=All, Formatter=Drupal Symfony Mailer Lite, Sender=Drupal Symfony Mailer Lite

    So it seems to me this is all set up correctly (assuming I want other system e-mails like password resets to remain handled with the default Drupal mail system as plain text, and the Contact form to use Drupal Symfony Mailer Lite as HTML).

    I really don't know what else to try, if something is still set up incorrectly, or if there is a legitimate bug or issue with this module.

    I will look forward to, and indeed expect, a reply from someone for this support request.

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

    This module doesn't force a change to the content type of your email unless you check the box to always use the default content type.

    The contact form must be sending a plain text email, and this module is dutifully passing it along in the specified content type. Check the box to always use the default, and it will force a change to the content type. However, note that this can lead to formatting issues. It will use the Plain Text text format to convert plain text to HTML, so you can adjust that format if you're unhappy with the results of the conversion.

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

    Thanks so much for the reply, and that makes sense! So now at /admin/config/symfony-mailer-lite/message-settings, I checked the box for "Always use the default content type". And now, after doing some more tests, those 2 notifications e-mails are sending as HTML.

    I appreciate also the note on the text formatting. Really, everything looks good to me by default *except* that the line breaks are missing. This is pushing sections of text together when there should be some spacing. For example, the plain text formatting in the e-mail notification looks like this:

    Paul Rollins (not verified) (name@mail.com) sent a message using the
    contact form at https://staging.domain.com/contact.
    
    Message
    Testing the e-mail setup again, after thinking I'd gotten it correct ...

    But now, that message is formatted like this:

    Paul Rollins (not verified) (name@mail.com) sent a message using the contact form at https://staging.domain.com/contact.
    Message
    Testing the e-mail setup again, after thinking I'd gotten it correct ...

    As you can see, it'd look a lot better if there was a space (or line break) between the first sentence and the "Message" line of text.

    So I'd like to do what you mentioned about adjusting that format if I'm unhappy with the results of the conversion. But I'm not sure where I would do this - is it in the UI (hopefully) or somewhere else? Also, if I just want to have the HTML follow the line breaks as they appear in the plain text, it'd be great to know what change(s) you'd recommend making to accomplish this.

Production build 0.71.5 2024