CodeIgniter Forums
Email class doesn't work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Email class doesn't work (/showthread.php?tid=67514)



Email class doesn't work - dashing - 03-03-2017

Hi, 

I'm actually trying to use Email class for sending mail, but when i try it, this message appear: 

Warning: include(C:\wamp64\www\onsen\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in C:\wamp64\www\onsen\system\core\Exceptions.php on line 269


I've already use it before with a oldest version of Codeigniter and everything work good.
I'm actually working with 3.1.3 Codeigniter'version.

There is m'y controller: 

function sendMail()
{

$nom = $this->input->post('name');
$mail = $this->input->post('email');
$sujet = $this->input->post('subject');
$message = $this->input->post('message');


$config = Array(
   'protocol' => 'smtp',
   'smtp_host' => 'smtp.numericable.be',
   'smtp_port' => 25,
   'smtp_user' => '',
   'smtp_pass' => '',
   'mailtype'  => 'html',
   'newline' =>"\r\n",
   'charset'   => 'UTF-8'
);

$this->load->library('email', $config);

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

$this->email->from($mail, $nom);
$this->email->to('******@outlook.com'); 

$this->email->subject($sujet);
$this->email->message(
'Message: ' .$message. '<br>'
);

$this->email->send();




//$this->load->view('onsen/contact');
redirect('contact');
}


If anyone else have the same problem ?


RE: Email class doesn't work - InsiteFX - 03-03-2017

Did you set your base_url in ./application/config/config.php ?


RE: Email class doesn't work - dashing - 03-03-2017

(03-03-2017, 03:19 PM)InsiteFX Wrote: Did you set your base_url in ./application/config/config.php ?

Yes i did it: $config['base_url'] = 'http://localhost/onsen'; where 'onsen' is the name my class (class onsen extends CI_Controller)  Undecided Undecided


RE: Email class doesn't work - Paradinight - 03-03-2017

(03-03-2017, 03:19 PM)InsiteFX Wrote: Did you set your base_url in ./application/config/config.php ?

Read the error Dodgy


@dashing

Warning: include(C:\wamp64\www\onsen\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in C:\wamp64\www\onsen\system\core\Exceptions.php on line 269

The Exceptions.php miss the error_php.php


RE: Email class doesn't work - Diederik - 03-04-2017

If you restore the missing (default) error viewfile you will proberbly see an error message explaining why you can't send emails.


RE: Email class doesn't work - InsiteFX - 03-04-2017

Your also missing the ending / slash on your base_url


RE: Email class doesn't work - dashing - 03-04-2017

(03-03-2017, 11:28 PM)Paradinight Wrote:
(03-03-2017, 03:19 PM)InsiteFX Wrote: Did you set your base_url in ./application/config/config.php ?

Read the error  Dodgy


@dashing

Warning: include(C:\wamp64\www\onsen\application\views\errors\html\error_php.php): failed to open stream: No such file or directory in C:\wamp64\www\onsen\system\core\Exceptions.php on line 269

The Exceptions.php miss the error_php.php

Thank you, i have finally find the solution to resolve it. Some files was missing (like error_php.php, error_general.php). Those files helped me to find where was the errors  Rolleyes


RE: Email class doesn't work - dashing - 03-04-2017

(03-04-2017, 12:46 AM)Diederik Wrote: If you restore the missing (default) error viewfile you will proberbly see an error message explaining why you can't send emails.

It's work now, thank you. I have restored some missing files (error_php.php and error_general.php), thanks to them i have find the solution ;-)