Loading a view to an email message sends a blank email

edited November 2012 in News & Announcements
I am trying to send an email from the blog module with a view as the message:
$this->email->message($this->load->view('confirmComment-html', $data, FALSE));

Although I send FALSE, I don't see the view in the browser.

The email that I am reciving has nothing in the body.

Printing the data array to the screen, gives me:
Array ( [lang] => A comment has been added to your blog post. To review the comment login to FUEL: [link] => http://localhost/highlandfuel/fuel/blog/comments [spam] => [published] => Published: no [author] => Author Name: pop [authorEmail] => Author Email: pop@gmail.com [authorWebsite] => Website: [authorIp] => Author IP: newtron (127.0.0.1) [comment] => Content: khhhlhh

Printing the email debugger:
220 mx.google.com ESMTP k2sm46358550eep.15

hello: 250-mx.google.com at your service, [197.87.58.102]
250-SIZE 35882577
250-8BITMIME
250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
250 ENHANCEDSTATUSCODES

from: 250 2.1.0 OK k2sm46358550eep.15

to: 250 2.1.5 OK k2sm46358550eep.15

data: 354 Go ahead k2sm46358550eep.15

250 2.0.0 OK 1352102857 k2sm46358550eep.15

quit: 221 2.0.0 closing connection k2sm46358550eep.15

Your message has been successfully sent using the following protocol: smtp

User-Agent: CodeIgniter
Date: Mon, 5 Nov 2012 00:03:44 -0800
From: "Highland Coffee Website"
Return-Path:
To: sigalzahav@gmail.com
Subject: =?utf-8?Q?Highland_Coffee_Roastery_Blog:_A_comment_has_been_added.?=
Reply-To: "admin@localhost"
X-Sender: admin@localhost
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <509772e03bc0d@localhost>
Mime-Version: 1.0

Content-Type: multipart/alternative; boundary="B_ALT_509772e03bc31"

This is a multi-part message in MIME format.
Your email application may not support this format.

--B_ALT_509772e03bc31
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

--B_ALT_509772e03bc31
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

--B_ALT_509772e03bc31--

My email view:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style> a { color: #F95506; } a:visited { color: #c60; } a:hover { color: #713800; } h2.highland { color: #9e5827; font-size: 14px; font-weight: bold; font-family: 'Homenaje', sans-serif; } </style> </head> <body> <div style="max-width: 800px; margin: 0; padding: 30px 0;"> <p><em>This is an automated message from Highland Coffee Roastery ordering system.</em></p> <p><em>Please do not reply to this email address.</em></p> <p><?= $lang . $link ?></p> <p><?= $spam ?></p> <p><?= $published ?></p> <p><?= $author ?></p> <p><?= $authorEmail ?></p> <p><?= $authorWebsite ?></p> <p><?= $authorIp ?></p> <p><?= $comment ?></p> <p>Have a great day,</p> <p> <h2 class="highland">Highland Coffee Roastery</h2> Maluti Highlands Centre<br /> Shop No. 9,<br /> Market St cnr Roos<br /> Clarens, 9707<br /> Free State<br /> </p> <p> Phone: (0)58 - 256 1136<br /> Website: www.highlandcoffeeroastery.co.za<br /> </p> <p><img src="<?php echo base_url(); ?>assets/images/logoSml.png" alt="Highland Coffee"/></p> </div> </body> </html>

Why do I get a blank email?

Comments

  • edited 12:28PM
    Have you loaded the library class with:

    $this->load->library('email', array('mailtype' => 'html'));

    Why are you using false to load the view? You need the view returned for use as markup/a variable for the email class.

    Try:
    $html = $this->load->view('confirmComment-html', $data, true); # echo $html; Uncomment if still no good. $this->email->message($html);
  • edited 12:28PM
    Ok, changing the False to True here$this->load->view('confirmComment-html', $data, false); helped. I somehow remembered that if I use False I will see the view on the screen.

    Thanks
Sign In or Register to comment.