diff --git a/application/helpers/mailer_helper.php b/application/helpers/mailer_helper.php index 48eb77651..d6bda9c14 100644 --- a/application/helpers/mailer_helper.php +++ b/application/helpers/mailer_helper.php @@ -39,7 +39,7 @@ function email_invoice($invoice_id, $invoice_template, $from, $to, $subject, $bo $db_invoice = $CI->mdl_invoices->where('ip_invoices.invoice_id', $invoice_id)->get()->row(); - $message = nl2br(parse_template($db_invoice, $body)); + $message = parse_template($db_invoice, $body); $subject = parse_template($db_invoice, $subject); $cc = parse_template($db_invoice, $cc); $bcc = parse_template($db_invoice, $bcc); @@ -60,7 +60,7 @@ function email_quote($quote_id, $quote_template, $from, $to, $subject, $body, $c $db_quote = $CI->mdl_quotes->where('ip_quotes.quote_id', $quote_id)->get()->row(); - $message = nl2br(parse_template($db_quote, $body)); + $message = parse_template($db_quote, $body); $subject = parse_template($db_quote, $subject); $cc = parse_template($db_quote, $cc); $bcc = parse_template($db_quote, $bcc); diff --git a/application/modules/mailer/controllers/mailer.php b/application/modules/mailer/controllers/mailer.php index 0614dd474..6018430a3 100755 --- a/application/modules/mailer/controllers/mailer.php +++ b/application/modules/mailer/controllers/mailer.php @@ -106,7 +106,11 @@ public function send_invoice($invoice_id) $pdf_template = $this->input->post('pdf_template'); $to = $this->input->post('to_email'); $subject = $this->input->post('subject'); - $body = htmlspecialchars_decode($this->input->post('body')); + if (strlen($this->input->post('body')) != strlen(strip_tags($this->input->post('body')))) { + $body = htmlspecialchars_decode($this->input->post('body')); + } else { + $body = htmlspecialchars_decode(nl2br($this->input->post('body'))); + } $cc = $this->input->post('cc'); $bcc = $this->input->post('bcc'); $attachment_files = $this->mdl_uploads->get_invoice_uploads($invoice_id); @@ -136,7 +140,11 @@ public function send_quote($quote_id) $pdf_template = $this->input->post('pdf_template'); $to = $this->input->post('to_email'); $subject = $this->input->post('subject'); - $body = htmlspecialchars_decode($this->input->post('body')); + if (strlen($this->input->post('body')) != strlen(strip_tags($this->input->post('body')))) { + $body = htmlspecialchars_decode($this->input->post('body')); + } else { + $body = htmlspecialchars_decode(nl2br($this->input->post('body'))); + } $cc = $this->input->post('cc'); $bcc = $this->input->post('bcc'); $attachment_files = $this->mdl_uploads->get_quote_uploads($quote_id);