fix reply to email

This commit is contained in:
Fred Tempez 2020-02-28 14:58:50 +01:00
parent a49b3d0ef1
commit 953f9f06de
3 changed files with 9 additions and 7 deletions

View File

@ -771,7 +771,7 @@ class common {
* @param string $content Contenu
* @return bool
*/
public function sendMail($to, $subject, $content, $replyTo = '') {
public function sendMail($to, $subject, $content, $replyTo = null) {
// Utilisation de PHPMailer version 6.0.6
//require_once "core/vendor/phpmailer/phpmailer.php";
//require_once "core/vendor/phpmailer/exception.php";
@ -786,7 +786,7 @@ class common {
$mail->CharSet = 'UTF-8';
$host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
$mail->setFrom('no-reply@' . $host, $this->getData(['config', 'title']));
if (empty($replyTo)) {
if (is_null($replyTo)) {
$mail->addReplyTo('no-reply@' . $host, $this->getData(['config', 'title']));
} else {
$mail->addReplyTo($replyTo);

View File

@ -296,7 +296,7 @@ class form extends common {
// Préparation le contenu du mail
$data = [];
$content = '';
$replyTo = '';
$replyTo = null;
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) {
// Filtre la valeur
switch($input['type']) {
@ -309,15 +309,17 @@ class form extends common {
case self::TYPE_DATETIME:
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
break;
CASE self::TYPE_CHECKBOX:
case self::TYPE_CHECKBOX:
$filter = helper::FILTER_BOOLEAN;
break;
default:
$filter = helper::FILTER_STRING_SHORT;
}
$value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']) === true ? 'X' : $this->getInput('formInput[' . $index . ']', $filter, $input['required']);
// Champ reply ajouté au mail
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true && $filter === helper::FILTER_MAIL) {
// premier chalmp email ajouté au mail en reply si option active
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
$input['type'] === 'mail' &&
$replyTo !== null) {
$replyTo = $value;
}
// Préparation des données pour la création dans la base

View File

@ -121,7 +121,7 @@
</div>
<div class="row">
<div class="col6 offset1">
<?php echo template::checkbox('formConfigMailReplyTo', true, 'Répondre au message de l\'expéditeur par email', [
<?php echo template::checkbox('formConfigMailReplyTo', true, 'Répondre à l\'expéditeur depuis le mail de notification', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'replyto']),
'help' => 'Cette option permet de réponse drectement à l\'expéditeur du message si celui-ci a indiqué un email valide.'
]); ?>