I'm about new at sending email using CodeIgniter. I have searched any tutorial and forum to handle send email using CodeIgniter, but none of them works for me. Hope someone can help.
This is the controller I use:
function send_email() {
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'xxxx@gmail.com',
'smtp_pass' => '****',
'mailtype' => 'text',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE
);
$message = '';
$this->load->library('email');
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from('xxxx@gmail.com');
$this->email->to('xxxx@gmail.com');
$this->email->subjects('Email Testing');
$this->email->message($message);
if($this->email->send()) {
echo 'Email sent!';
} else {
show_error($this->email->print_debugger());
}
}
I have edited php.ini as forum said, such as:
;For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail
; ... or under UNIX:
;
; extension=msql.so
extension=php_openssl.dll
I work Apache/2.2.22 (Ubuntu) Server.
And it shows blank page when I try to call the function. Is there any config to edit? Please give your suggestion. Thank you.
Updated:
This is the display_errors and error_reporting I edited in php.ini :
; display_errors
Default Value: On
Development Value: On
Production Value: On
; error_reporting
Default Value: E_ALL & ~E_NOTICE
Development Value: E_ALL | E_STRICT
Production Value: E_ALL & ~E_DEPRECATED