Welcome Guest, Not a member yet? Register   Sign In
Email class doesn't seem to work at all

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.


[eluser]Abel A.[/eluser]

Sorry, didn't include it as it's just a test controller at the moment:-


class Test extends CI_Controller {

function index(){


   $this->email->from('support@localhost', 'test');
   $this->email->message('testing message');
   echo $this->email->print_debugger();




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

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.

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!

[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

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

Theme © iAndrew 2016 - Forum software by © MyBB