views:

37

answers:

1

Hi, I want to send emails using codeignitor email library.My controller is as follows;

  Class Users extends Controller
{
    function users()
    {
        parent::Controller();
        $this->load->library('email');
    }
    function testmail()
    {
        $this->email->to('[email protected]');
        $this->email->from('[email protected]');
            $this->email->subject('Email Cofirmation mail');
        $this->email->message('Email Cofirmation mail from Codeignitor');
        if($mail = $this->email->send())
            echo 1;
        else
            echo 0;
    }
}

my Email.php placed in ../system/libraries.Mail is not working.the above program returns 0(fails).Is there any additional configuration need to send a mail.Any help will be appreciable.thanks

A: 

Make sure you have set up your email preferences correctly. See this page of the user guide for instructions:

http://codeigniter.com/user_guide/libraries/email.html

Pay particular attention to the smtp settings ie smtp_host, smtp_user and smtp_pass. Depending on how your system is set up these will need to be configured.

musoNic80