Message: Undefined variable: data when trying to send HTML mail |
[eluser]spheroid[/eluser]
I'm able to send email by defining my HTML mail message within the code directly. But according to another post on the forums, I realized I could load a view. When I do I get this message: A PHP Error was encountered Severity: Notice Message: Undefined variable: data Filename: controllers/user.php I'm loading my email config variables from email.php. Here is the code to load the view/create the email (partial): Code: $this->email->subject('Email Test. Is this your email address: '.$sendto); What can I do to fix this? Thanks in advance!!
[eluser]Derek Allard[/eluser]
Ah, probably stealing my bad code are you ![]() Above the code I posted I had Code: $data['title'] = "some text"; If you don't think you'll need to pass it any info, you could always just do Code: $data = new array(); and that would satisfy the function.
[eluser]spheroid[/eluser]
Thanks for the quick reply! Yeah, for the code put it on my tab (call me Norm!). Now I have this, this is the only code in one controller function to test it out. I get a blank page, and no debug results. Hmm. What else could it be? Code: $this->load->library('email');
[eluser]Derek Allard[/eluser]
I'd start eliminating things. Can you do $this->email->message('foo'); successfully? that would at least reduce what might be happening.
[eluser]spheroid[/eluser]
That works. I'm still trying to eliminate things. When I do use 'foo' instead, the debug shows it's sending as text, not html.
[eluser]Derek Allard[/eluser]
So um... have you configured it to send as html ![]()
[eluser]spheroid[/eluser]
I thought I did. I checked my config file, saved as "email.php" in my config folder. Saving as "Email.php" doesn't work (debug yields nothing). config/email.php Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); function from my controller Code: function hey()
[eluser]spheroid[/eluser]
Strange. I modified the Email.php file in the system/libraries folder to html and it worked. Then I changed back to text in that file. I moved the "email.php" file from my application/config to application/libraries folder, and since it didn't work, I moved it back to application/config, and renamed to Email.php. Now it works. Ugh. Another one of those issues where I don't know what caused it. Thanks for your help! Loving CI!
[eluser]Derek Allard[/eluser]
Wow, I love self-healing applications ![]()
[eluser]vinod_ci[/eluser]
hello guys i have same problem i have send mail of html type $message =$this->load->view('with-ads',''); $config['wordwrap'] = false; $config['mailtype'] = 'html'; $this->email->initialize($config); $this->email->to($to); $this->email->from('[email protected]'); $this->email->subject('Here is your info '.'gggdf'); $this->email->message($message); But i can't see any table in email only one statement like this --B_ALT_42eaae77d421c-- please reply fast |
Welcome Guest, Not a member yet? Register Sign In |