I recieve messages without HTML tags. Only text values.

CommentFileSizeAuthor
#6 2777695-mail-plugin.patch1.66 KBgeerlingguy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

divined created an issue. See original summary.

geerlingguy’s picture

Title: Sent messages without HTML tags. » Sent messages have HTML markup stripped, are plain text
Version: 8.x-1.1 » 8.x-1.x-dev

Confirmed. I'm upgrading my own site today, and found that the default PhpMail class in Drupal 8 strips all markup from every message, with no ability to override.

So the quick solution would be to find another mail plugin (like swiftmailer, or mimemail) and set that in your settings.php:

$config['system.mail']['interface']['default'] = 'some_other_system';

I'm going to see if that works. Otherwise you may need to install the mailsystem module to switch. I'm considering adding an interface / plugin to basically do the same thing as core's PhpMail, but removing the part that strips markup from the body.

geerlingguy’s picture

I've also opened an issue in my site's issue tracker to see if I can come up with a temporary solution: Emails are not sent with HTML formatting.

geerlingguy’s picture

I just noticed I implement a mail handler: SimpleMailMailer. It looks like the file is named incorrectly so it can't be identified / used currently.

But if it could be and if I could get it to work with HTML emails, you could override in settings.php:

$config['system.mail']['interface']['default'] = 'simple_mail_mailer';
geerlingguy’s picture

If I try the above I get:

In DiscoveryTrait.php line 53:
                                                                                                                       
  The "simple_mail_mailer" plugin does not exist. Valid plugin IDs for Drupal\Core\Mail\MailManager are: php_mail, test_mail_collector 
geerlingguy’s picture

Status: Active » Needs review
FileSize
1.66 KB

Attached patch fixes the HTML email problem.

To use the SimpleMail plugin, you have to add the following to your settings.php:

$config['system.mail']['interface']['default'] = 'simple_mail';
geerlingguy’s picture

Status: Needs review » Reviewed & tested by the community

  • geerlingguy committed 9bdbef7 on 8.x-1.x
    Issue #2777695 by geerlingguy: Sent messages have HTML markup stripped,...
geerlingguy’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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