Skip to content

Commit e987489

Browse files
Merge pull request #27 from mourique/disable_html_mails
add option to disable sending html emails, only plaintext
2 parents a710859 + c8f0c5a commit e987489

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

classes/Form.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,18 +448,22 @@ public function sendNotification($body = NULL, $recipient = NULL)
448448
}
449449

450450
try {
451-
451+
452452
$emailData = [
453453
'from' => option('microman.formblock.from_email'),
454454
'to' => explode(';', $recipient),
455455
'subject' => $this->message('notify_subject'),
456-
'attachments' => $this->attachments,
457-
'body' => [
458-
'text' => Str::unhtml($body),
459-
'html' => $body
460-
]
456+
'attachments' => $this->attachments
461457
];
462458

459+
if (option('microman.formblock.disable_html')) {
460+
$body_array = array('text' => Str::unhtml($body));
461+
} else {
462+
$body_array = array('text' => Str::unhtml($body), 'html' => $body);
463+
}
464+
465+
$emailData["body"] = $body_array;
466+
463467
if ($replyTo = $this->form_field('email', 'value')) {
464468
$emailData['replyTo'] = $replyTo;
465469
}

index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'default_language' => 'en',
2525
'disable_confirm' => false,
2626
'disable_notify' => false,
27+
'disable_html' => false,
2728
'dynamic_validation' => true
2829
],
2930
'templates' => [ 'formcontainer' => __DIR__ . "/templates/formcontainer.php" ],

0 commit comments

Comments
 (0)