using json to load the mail allows to place everything message related in the view (e.g. the subject)

This commit is contained in:
HB9HIL
2024-10-28 12:37:31 +01:00
parent d22b3fda13
commit bbb1b8c976
3 changed files with 10 additions and 6 deletions

View File

@@ -374,8 +374,8 @@ class Options extends CI_Controller {
$this->email->from($this->optionslib->get_option('emailAddress'), $this->optionslib->get_option('emailSenderName'));
$this->email->to($email);
$this->email->subject('Wavelog Test-Mail');
$this->email->message($message);
$this->email->subject($message['subject']);
$this->email->message($message['body']);
if (! $this->email->send()){
$this->session->set_flashdata('testmailFailed', __("Testmail failed. Something went wrong."));

View File

@@ -1,6 +1,8 @@
<?=
<?php
__("Hi,
$message['subject'] = __("Wavelog Test-Mail");
$message['body'] = __("Hi,
This is a test email from your Wavelog instance.
@@ -9,3 +11,5 @@ If you received this email, your mail settings are correct.
Regards,
Wavelog");
echo json_encode($message);

View File

@@ -469,7 +469,7 @@ class CI_Email {
* @param array $data = array()
* @param string language
*
* @return string message
* @return string message in json format
*/
public function load($view, $data = array(), $language = NULL) {
@@ -492,7 +492,7 @@ class CI_Email {
_setlocale(LC_ALL, $origin_lang);
}
return html_entity_decode($message);
return json_decode(html_entity_decode($message), true);
}
// --------------------------------------------------------------------