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();
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2865880-smtp-header-subject.patch | 598 bytes | mnico |
Comments
Comment #2
paku commentedComment #3
paku commentedComment #4
mnico commentedThe patch works for me
Thank you!
PS: Upload the patch to a file.
Comment #5
mnico commentedI will help you with the patch
Regards
Comment #6
petergus commentedThis works, but how to set the reply-to name as well?
Comment #7
recidive commentedDuplicate of #2755027: Wrong character encoding in sender name.