Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7812661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:35:02+00:00 2026-06-02T04:35:02+00:00

This has to be simple, I’m trying to load a view file as my

  • 0

This has to be simple, I’m trying to load a view file as my email message using CodeIgniter. The point is to have an HTML and not just a text-based message.

Currently, my emails are sending ok but the messages are empty if my code looks like what it does below:

Here’s the relevant part of the php:

    $config=array(
    'protocol' => 'smtp',
    'smtp_host' => 'xxx',
    'smtp_user' => 'xxx',
    'smtp_pass' => 'xxx',
    'smtp_port' => 587,
    'mailtype' => 'html',
    'crlf' => "\r\n",
    'newline' => "\r\n"
  );
 $this->email->initialize($config);
 $this->email->subject('testing loading a view file');
 $msg = $this->load->view('reviews/email', '', false);
 $this->email->message($msg);

Here’s what the reviews/email.php file looks like:

<html>
<head></head>
    <body> <h1>this should be BIG</h1> this should not
          <a href="http://google.com/<? $php='login'; echo $php?>">Google</a>
    </body>
</html>

Thanks for any advice you might have,

Tim

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:35:05+00:00Added an answer on June 2, 2026 at 4:35 am

    You’re loading the view incorrectly. The third parameter is supposed to be TRUE so that CodeIgniter will return the view as a string.

    $msg = $this->load->view('reviews/email', '', true);
    

    From http://codeigniter.com/user_guide/general/views.html:

    There is a third optional parameter lets you change the behavior of
    the function so that it returns data as a string rather than sending
    it to your browser. This can be useful if you want to process the data
    in some way. If you set the parameter to true (boolean) it will return
    data. The default behavior is false, which sends it to your browser.
    Remember to assign it to a variable if you want the data returned:

    $string = $this->load->view('myfile', '', true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this has been asked many times before... I have a simple ('#Div').load(file.php?id='+id+'&page='+page)
in iPhone, this would be simple---each view has a scrollViewDidScroll method. I am trying
Im pretty sure this has a simple solution. I am using jCarousellite, and i
I have this relatively simple regex for usernames // Enforce that username has to
I am trying to understand this simple hashlib code in Python that has been
I have a neat Model based off QAbstractItemModel. This has a simple hierarchical tree
Hopefully this question has a simple answer i'm overlooking! I have an IIS webserver
I'm sure this has a very simple answer I am not finding... I have
I bet this has a simple answer.. Let's say I have a Post model
I have several simple Perl programs writing to the standard output, but this has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.