Skip to content

Commit

Permalink
Sender email not required anymore for autoresponse config
Browse files Browse the repository at this point in the history
  • Loading branch information
PubliAlex committed Apr 2, 2024
1 parent dbf1a9d commit 605be4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 6 additions & 9 deletions classes/SendMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 605be4e

Please sign in to comment.