Merge branch 'fix-email-encoding-issues' into 'develop'
Fix email issues Closes #419 et #416 See merge request framasoft/framadate/framadate!364
This commit is contained in:
commit
69d00042e6
@ -68,10 +68,12 @@ class MailService {
|
|||||||
// Bodies
|
// Bodies
|
||||||
$body = $body . ' <br/><br/>' . __('Mail', 'Thank you for your trust.') . ' <br/>' . NOMAPPLICATION . ' <hr/>' . __('Mail', "\"The road is long, but the way is clear…\"<br/>Framasoft lives only by your donations.<br/>Thank you in advance for your support https://soutenir.framasoft.org");
|
$body = $body . ' <br/><br/>' . __('Mail', 'Thank you for your trust.') . ' <br/>' . NOMAPPLICATION . ' <hr/>' . __('Mail', "\"The road is long, but the way is clear…\"<br/>Framasoft lives only by your donations.<br/>Thank you in advance for your support https://soutenir.framasoft.org");
|
||||||
$mail->isHTML(true);
|
$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
|
// Build headers
|
||||||
$mail->CharSet = 'UTF-8';
|
|
||||||
$mail->addCustomHeader('Auto-Submitted', 'auto-generated');
|
$mail->addCustomHeader('Auto-Submitted', 'auto-generated');
|
||||||
$mail->addCustomHeader('Return-Path', '<>');
|
$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('/<a[^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/si', '${2}: ${1}', $html);
|
||||||
|
|
||||||
|
return $mailer->html2text($html);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
11
composer.lock
generated
11
composer.lock
generated
@ -806,16 +806,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpmailer/phpmailer",
|
"name": "phpmailer/phpmailer",
|
||||||
"version": "v6.0.5",
|
"version": "v6.0.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
"url": "https://github.com/PHPMailer/PHPMailer.git",
|
||||||
"reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32"
|
"reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/cb3ea134d4d3729e7857737d5f320cce9caf4d32",
|
"url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/0c41a36d4508d470e376498c1c0c527aa36a2d59",
|
||||||
"reference": "cb3ea134d4d3729e7857737d5f320cce9caf4d32",
|
"reference": "0c41a36d4508d470e376498c1c0c527aa36a2d59",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -868,7 +868,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "PHPMailer is a full-featured email creation and transfer class for PHP",
|
"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",
|
"name": "psr/log",
|
||||||
@ -2580,6 +2580,7 @@
|
|||||||
"mock",
|
"mock",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
|
"abandoned": true,
|
||||||
"time": "2017-06-30T09:13:00+00:00"
|
"time": "2017-06-30T09:13:00+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user