Have found the PL language emails comes with malformed subject line if the subject consists of non plain ASCII characters.
Subject is not UTF-8 encoded.

The solution is to change the line 103 of the SMTPMailSystem.php

from
$subject = $message['subject'];
to
$subject = Unicode::mimeHeaderEncode($message['subject']);

the same issue for 7.x but on PHPMailer level is covered here:

https://www.drupal.org/node/1408226

Patch:

drupal8/modules/smtp/src/Plugin/Mail/SMTPMailSystem.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drupal8/modules/smtp/src/Plugin/Mail/SMTPMailSystem.php b/drupal8/modules/smtp/src/Plugin/Mail/SMTPMailSystem.php
index 2579303..bd99ef2 100644
--- a/drupal8/modules/smtp/src/Plugin/Mail/SMTPMailSystem.php
+++ b/drupal8/modules/smtp/src/Plugin/Mail/SMTPMailSystem.php
@@ -100,7 +100,7 @@ public function mail(array $message) {
$from = $message['from'];
$body = $message['body'];
$headers = $message['headers'];
- $subject = $message['subject'];
+ $subject = Unicode::mimeHeaderEncode($message['subject']);

// Create a new PHPMailer object - autoloaded from registry.
$mailer = new PHPMailer();

CommentFileSizeAuthor
#5 2865880-smtp-header-subject.patch598 bytesmnico

Comments

paku created an issue. See original summary.

paku’s picture

Title: Malform subjects for none plane ASCI characters (UTF-8 encoded) » Malformed subjects for none plane ASCI characters (UTF-8 encoded)
paku’s picture

Issue summary: View changes
mnico’s picture

The patch works for me

Thank you!

PS: Upload the patch to a file.

mnico’s picture

Status: Active » Needs review
StatusFileSize
new598 bytes

I will help you with the patch
Regards

petergus’s picture

This works, but how to set the reply-to name as well?

recidive’s picture

Status: Needs review » Closed (duplicate)