diff --git a/classes/SendMail.php b/classes/SendMail.php index 26bb2eb..616a403 100644 --- a/classes/SendMail.php +++ b/classes/SendMail.php @@ -122,18 +122,15 @@ public static function sendAutoResponse($properties, $post, $record) { $from = isset($properties['mail_resp_from']) ? $properties['mail_resp_from'] : null; $subject = isset($properties['mail_resp_subject']) ? $properties['mail_resp_subject'] : null; - if (filter_var($to, FILTER_VALIDATE_EMAIL) && filter_var($from, FILTER_VALIDATE_EMAIL)) { - + if (filter_var($to, FILTER_VALIDATE_EMAIL)) { // CUSTOM TEMPLATE + $template = isset($properties['mail_resp_template']) && $properties['mail_resp_template'] != '' && MailTemplate::findOrMakeTemplate($properties['mail_resp_template']) ? $properties['mail_resp_template'] : 'publipresse.forms::mail.autoresponse'; - Mail::sendTo($to, $template, [ - 'id' => $record->id, - 'data' => $post, - 'ip' => $record->ip, - 'date' => $record->created_at - ], function ($message) use ($from, $subject) { - $message->from($from); + Mail::sendTo($to, $template, $data, function ($message) use ($from, $subject) { + if(isset($from) && filter_var($from, FILTER_VALIDATE_EMAIL)) { + $message->from($from); + } if (isset($subject)) { $message->subject($subject); } diff --git a/updates/version.yaml b/updates/version.yaml index 0efa726..cdf2c6a 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -8,3 +8,5 @@ - Don't load filepond scripts if file upload is disabled 1.0.3: - Fix compatibility with october CMS 3.6 +1.0.4: + - Sender email not mandatory anymore in autoresponse notification. If not specied, global email configuration will be used. \ No newline at end of file