Welcome Guest, Not a member yet? Register   Sign In
Email class not working.
#1

[eluser]smithas[/eluser]
Hi..I am new to CodeIgniter.I was trying out the email class..
but it is not working properly.
the code is given below

Quote:<?php

class Test_email extends Controller
{
function Test_email()
{
// load controller parent
parent::Controller();
$this->load->library('email');
}
function sendEmail()
{



$this->email->set_newline("\r\n");

$this->email->from('[email protected]', 'Your Name');
$this->email->to('[email protected]');

$this->email->subject(' CodeIgniter Rocks ');
$this->email->message('Hello World');


if (!$this->email->send())

show_error($this->email->print_debugger());
else
echo 'Your e-mail has been sent!';


}
}

when i work this code,i get the message "your email has been sent"..but when i check in my mail box..i dont find it.
Is there anything else to be done in php configurations or apache configurations for sending email?
#2

[eluser]Christoffer[/eluser]
Well, you need to set up an e-mail server to be able to send e-mail. Do a Google search and I'm sure you'll find what you are looking for Smile
#3

[eluser]smithas[/eluser]
I had OpenSSl enabled..
I modified the pgm to

Quote:<?php

class Test_email extends Controller
{
function Test_email()
{
// load controller parent
parent::Controller();
$this->load->library('email');
}
function sendEmail()
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'emailid',
'smtp_pass' => 'password',
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");

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

$this->email->subject(' CodeIgniter Rocks ');
$this->email->message('Hello World');


if (!$this->email->send())
show_error($this->email->print_debugger());
else
echo 'Your e-mail has been sent!';
}
}


still the mail is not getting sent Sad
#4

[eluser]Christoffer[/eluser]
Still, do you have SMTP set up in Apache?




Theme © iAndrew 2016 - Forum software by © MyBB