diff --git a/app/classes/Framadate/Services/MailService.php b/app/classes/Framadate/Services/MailService.php index ce8aa0b..5fcccfa 100644 --- a/app/classes/Framadate/Services/MailService.php +++ b/app/classes/Framadate/Services/MailService.php @@ -68,10 +68,12 @@ class MailService { // Bodies $body = $body . '

' . __('Mail', 'Thank you for your trust.') . '
' . NOMAPPLICATION . '
' . __('Mail', "\"The road is long, but the way is clear…\"
Framasoft lives only by your donations.
Thank you in advance for your support https://soutenir.framasoft.org"); $mail->isHTML(true); - $mail->msgHTML($body, ROOT_DIR, true); + $mail->CharSet = PHPMailer::CHARSET_UTF8; + $mail->msgHTML($body, ROOT_DIR, function ($html) use ($mail) { + return $this->html2text($mail, $html); + }); // Build headers - $mail->CharSet = 'UTF-8'; $mail->addCustomHeader('Auto-Submitted', 'auto-generated'); $mail->addCustomHeader('Return-Path', '<>'); @@ -124,4 +126,16 @@ class MailService { } } } + + /** + * Custom "advanced" callback to pass to msgHTML function + * + * @param PHPMailer $mailer a PHPMailer instance + * @param string $html the HTML body of an email + */ + private function html2text(PHPMailer $mailer, $html) { + $html = preg_replace('/]*href="([^"]+)"[^>]*>(.*?)<\/a>/si', '${2}: ${1}', $html); + + return $mailer->html2text($html); + } } diff --git a/composer.lock b/composer.lock index 853d393..f11945d 100644 --- a/composer.lock +++ b/composer.lock @@ -806,16 +806,16 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.0.5", + "version": "v6.0.7", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32" + "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/cb3ea134d4d3729e7857737d5f320cce9caf4d32", - "reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/0c41a36d4508d470e376498c1c0c527aa36a2d59", + "reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59", "shasum": "" }, "require": { @@ -868,7 +868,7 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "time": "2018-03-27T13:49:45+00:00" + "time": "2019-02-01T15:04:28+00:00" }, { "name": "psr/log", @@ -2580,6 +2580,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2017-06-30T09:13:00+00:00" }, {