• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Email class doesn't seem to work at all

#1
[eluser]Dandy_andy[/eluser]
I cant seem to use any of the email class functions anywhere in my site. I have set up my localhost email system and I can send and receive emails fine through SMTP. However, when loading the email library, none of the functions seem to work and I get the error message:-

"Fatal error: Call to undefined method Email::from() in C:\xampp\testsite1\application\controllers\test.php on line 11"

The undefined method error applies to anything related to the email library and I can't figure out why. I've tried to autoload the 'email' library but that doesn't work.

I have also tried using the php mail() function and that works fine. Why doesn't the library 'email' class work? Any ideas?

Thanks in advance.


#2
[eluser]Abel A.[/eluser]
code?

#3
[eluser]Dandy_andy[/eluser]
Sorry, didn't include it as it's just a test controller at the moment:-

Code:
<?php

class Test extends CI_Controller {



function index(){

   $this->load->library('email');

   $this->email->from('[email protected]', 'test');
   $this->email->to('[email protected]');
   $this->email->subject('Test');
   $this->email->message('testing message');
   $this->email->send();
   echo $this->email->print_debugger();

}

}

?>

#4
[eluser]Abel A.[/eluser]
Have you tried using real email addresses? like [email protected] instead of localhost.

#5
[eluser]Dandy_andy[/eluser]
Yep, tried that and still the same thing. The strange thing is, I can send mail through the controller using the php mail() function and they work fine on the localhost... I'm really scratching my head now and hoping it's something silly that I've overlooked.

#6
[eluser]Dandy_andy[/eluser]
Ok, figured it out. As usual it was me being a wally - I left a test file in the applications library folder entitled email.php and forgot to remove it! I'm learning so many lessons with CI, mainly that most mistakes are caused by my ignorance and tired brain!

#7
[eluser]Abel A.[/eluser]
are you on linux?

You might have to edit the sendmail path in the Email.php file in CI under system

#8
[eluser]Abel A.[/eluser]
Good to hear!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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