Merge pull request #29232 from FHenry/dev_replyto_emailing

NEW: add field Reply to in emailing
This commit is contained in:
Laurent Destailleur 2024-04-04 19:15:17 +02:00 committed by GitHub
commit 43ddf2da34
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -360,7 +360,7 @@ if (empty($reshook)) {
// Mail making
$trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
$upload_dir_tmp = $upload_dir;
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp);
$mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', $replyto, $upload_dir_tmp);
if ($mail->error) {
$res = 0;
@ -580,7 +580,7 @@ if (empty($reshook)) {
}
// Action update description of emailing
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setemail_replyto' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitle') {
@ -1076,6 +1076,23 @@ if ($action == 'create') {
print '</td></tr>';
}
// Reply to
if ($object->messtype != 'sms') {
print '<tr><td>';
print $form->editfieldkey("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string');
print '</td><td>';
print $form->editfieldval("MailReply", 'email_replyto', $object->email_replyto, $object, $user->hasRight('mailing', 'creer') && $object->status < $object::STATUS_SENTCOMPLETELY, 'string');
$email = CMailFile::getValidAddress($object->email_replyto, 2);
if ($email && !isValidEmail($email)) {
$langs->load("errors");
print img_warning($langs->trans("ErrorBadEMail", $email));
} elseif ($email && !isValidMailDomain($email)) {
$langs->load("errors");
print img_warning($langs->trans("ErrorBadMXDomain", $email));
}
print '</td></tr>';
}
print '</table>';
print '</div>';