Unverified Commit a7ac7d82 authored by Adrien Clairembault's avatar Adrien Clairembault Committed by GitHub
Browse files

Fix encoding for "message/rfc822" attachments (#9176)

* Fix encoding for "message/rfc822" attachments

* Fix typo
parent 4b489b6f
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
*/ */
use PHPMailer\PHPMailer\PHPMailer;
if (!defined('GLPI_ROOT')) { if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly"); die("Sorry. You can't access this file directly");
} }
...@@ -355,9 +357,19 @@ class NotificationEventMailing extends NotificationEventAbstract implements Noti ...@@ -355,9 +357,19 @@ class NotificationEventMailing extends NotificationEventAbstract implements Noti
'mail' 'mail'
); );
} }
$encoding = PHPMailer::ENCODING_BASE64;
$mime = mime_content_type($path);
if ($mime == "message/rfc822") {
// messages/rfc822 can't be encoded in base64 according to RFC2046
// https://datatracker.ietf.org/doc/html/rfc2046
$encoding = PHPMailer::ENCODING_8BIT;
}
$mmail->addAttachment( $mmail->addAttachment(
$path, $path,
$document->fields['filename'] $document->fields['filename'],
$encoding
); );
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment