Reputation: 7109
I want to send emails using codeigniter 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.
Upvotes: 0
Views: 6022
Reputation: 3696
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.
Upvotes: 1