i trying send email codeigniter here code
function sendmail() { // set smtp configuration $emailconfig = array( 'protocol' => 'smtp', 'smtp_host' => 'tls://smtp.googlemail.com', 'smtp_port' => 587, 'smtp_user' => 'email@gmail.com', 'smtp_pass' => '******', 'mailtype' => 'html', 'charset' => 'iso-8859-1' ); // set email information $from = array('email' => 'frommail@gmail.com', 'name' => 'your name'); $to = array('mymail@gmail.com'); $subject = 'your gmail subject here'; $message = 'type gmail message here'; // load codeigniter email library $this->load->library('email', $emailconfig); // have set new line character better result $this->email->set_newline("rn"); // set email preferences $this->email->from($from['email'], $from['name']); $this->email->to($to); $this->email->subject($subject); $this->email->message($message); // ready send email , check whether email sent if (!$this->email->send()) { // raise error message show_error($this->email->print_debugger()); } else { // show success notification or other things here echo 'success send email'; } }
but gives me type of error
the following smtp error encountered: 110 connection timed out unable send data: auth login failed send auth login command. error: unable send data: mail from:
from:
the following smtp error encountered: unable send data: rcpt to:
to:
the following smtp error encountered: unable send data: data
data:
the following smtp error encountered: unable send data: user-agent: codeigniter date: fri, 29 jan 2016 06:59:14 +0000 from: "alex tester" return-path: to: coderjack9@gmail.com subject: =?iso-8859-1?q?email_test?= reply-to: "alextester1003@gmail.com" x-sender: alextester1003@gmail.com x-mailer: codeigniter x-priority: 3 (normal) message-id: <56ab0dc2af7ad@gmail.com> mime-version: 1.0 content-type: multipart/alternative; boundary="b_alt_56ab0dc2af809" multi-part message in mime format. email application may not support format. --b_alt_56ab0dc2af809 content-type: text/plain; charset=iso-8859-1 content-transfer-encoding: 8bit testing email class. --b_alt_56ab0dc2af809 content-type: text/html; charset=iso-8859-1 content-transfer-encoding: quoted-printable testing email class. --b_alt_56ab0dc2af809-- unable send data: .
the following smtp error encountered: unable send email using php smtp. server might not configured send mail using method.
$this->load->library('email'); $this->load->library('user_agent'); $this->email->from(from@gmail.com); $this->email->to(to@gmail.com); $this->email->cc(cc@gmail.com); $this->email->subject('sub');$this->email->message($messages); $this->email->send();
note: mail cannot sent localhost. if try live sites.
Comments
Post a Comment