trying to load Email class gives non-object error

#1
[eluser]GuyFawkes[/eluser]
Hi all,
I'm trying to create a rather simple login page and so far everything has gone smoothly up to the point where I thought it would be a good idea to send a confirmation email to the user who completes the form. My problem is though when I try to load and use the email class i get the following error:

Fatal error: Call to a member function on a non-object.

I've read through a few posts on here covering similar problems but none of the solutions work. I've tried autoloading the class, i've tried loading it in the controllers constructor, i've even tried switching between php4 and php5 on my hosting account and I still get this error.

The strange thing is the form_validation class loads and works just fine. Does anyone at all have any suggestions on how to fix this, it really is starting to get very frustrating.

Many thanks in advance
Guy Fawkes Wink

#2
[eluser]GuyFawkes[/eluser]
Just noticed that in the codeigniter log it says the email class is being initialized, yet as soon as this line of code is reached...

$this->email->from('[email protected]','myname');

the server log reports the non-object error.

#3
[eluser]GuyFawkes[/eluser]
Solved the problem, when loading the email class i used the third parameter to give it a different name and it worked. Not sure why $this->email didn't work, although the only thing i can think of is that maybe because one of my form fields had the name email, it might have been confusing the issue.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.