CodeIgniter Forums

Full Version: Mail not receieved using email library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Neha[/eluser]
Hi,

I am trying to send mail using email class library, but I did not get the mail 1 hour is passed.

Here is the code I m using in controller
loading library.........

$this->load->library('email');
Function to send mail

$config['protocol'] = 'sendmail';
$this->email->initialize($config);
$this->email->from('someaddr');
$this->email->to('myaddress');
$this->email->cc('someaddr');

$this->email->subject('subject');
$this->email->message('message');

$this->email->send();

Here is the email.php file in config folder


$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['mailtpye'] = 'html';

Please help me in this issue.

Thanks in advance.

El Forum

[eluser]Tominator[/eluser]
Hi!

Please use [co.de] tags for your script next time. Back to the problem - I'm using PHPMailer and works great.

Tom.

El Forum

[eluser]Neha[/eluser]
Hi,
I had tried php mail function but it wasn't working too. I found somewhere that its good to send mail using codeigniter's email library. Please someone help. Is anything wrong in my code as I am not receiving mails.

Thanks
Neha

El Forum

[eluser]Tominator[/eluser]
Are you sending it from localhost? Because it doesn't work ...

El Forum

[eluser]Neha[/eluser]
Hi,

No I m not sending it from localhost. Even when I use this
Code:
echo $this->email->print_debugger();
I get the mssg mail succesfully sent, but I did not receieve the mail.

Thanks
Neha

El Forum

[eluser]Tominator[/eluser]
Hi!

Try PHPMailer, because I have no other solution for you. If it doesn't work, it will be problem of server.

I've attached phpMailer library to this post, copy it to your system/libraries. Example of use:

Code:
$this->load->library('phpmailer');

$this->phpmailer->WordWrap = 50;
$this->phpmailer->IsHTML(true);
$this->phpmailer->Charset = "utf-8";
                
$this->phpmailer->From = '[email protected]';
                
$this->phpmailer->AddAddress('[email protected]');
                
$this->phpmailer->Subject = 'some subject';
$this->phpmailer->Body    = 'some text as body';
$this->phpmailer->AltBody = 'some text for alternative clients';
                
$this->phpmailer->Send();

If you want to do something advanced, take a look into docs:
http://phpmailer.worxware.com/

Tom

El Forum

[eluser]Neha[/eluser]
Hi,
I am really sorry to bother you, but I m newbie. I got the error could not instantiate mail class this time.

Thanks

El Forum

[eluser]Zack Kitzmiller[/eluser]
Checkout Postmark, and the Postmark CodeIgniter library. http://www.postmarkapp.com, it should help quite abit, as you won't need to send email from your server anymore.

El Forum

[eluser]Zocee[/eluser]
I’m having a weird problem here please see the following link:

http://ellislab.com/forums/viewthread/163620/