Merge pull request #17489 from Hystepik/develop#1
Fix #17475 : Add of List-Unsubscribe in mass emailing
This commit is contained in:
commit
d0c634a99c
@ -281,7 +281,13 @@ if (empty($reshook)) {
|
||||
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
$newsubject = make_substitutions($subject, $substitutionarray);
|
||||
$newmessage = make_substitutions($message, $substitutionarray);
|
||||
$newmessage = make_substitutions($message, $substitutionarray, null, 0);
|
||||
|
||||
$moreinheader = '';
|
||||
if (preg_match('/__UNSUBSCRIBE__/', $message)) {
|
||||
$moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n";
|
||||
$moreinheader = make_substitutions($moreinheader, $substitutionarray);
|
||||
}
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
@ -299,7 +305,7 @@ if (empty($reshook)) {
|
||||
|
||||
// Mail making
|
||||
$trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, '', 'emailing');
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing');
|
||||
|
||||
if ($mail->error) {
|
||||
$res = 0;
|
||||
|
||||
@ -7317,7 +7317,6 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
|
||||
} else {
|
||||
$value = dol_nl2br("$value");
|
||||
}
|
||||
|
||||
$text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,6 +269,12 @@ if ($resql) {
|
||||
|
||||
$substitutionisok = true;
|
||||
|
||||
$moreinheader = '';
|
||||
if (preg_match('/__UNSUBSCRIBE__/', $message)) {
|
||||
$moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n";
|
||||
$moreinheader = make_substitutions($moreinheader, $substitutionarray);
|
||||
}
|
||||
|
||||
$arr_file = array();
|
||||
$arr_mime = array();
|
||||
$arr_name = array();
|
||||
@ -285,7 +291,7 @@ if ($resql) {
|
||||
}
|
||||
// Fabrication du mail
|
||||
$trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, '', 'emailing');
|
||||
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing');
|
||||
|
||||
if ($mail->error) {
|
||||
$res = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user