Unable to send email using PHP mail(). Your server might not be configured to send mail using this method
11,665
You are done all correct but you have issue on initialize the mail
Just change this
$this->load->library('email',$config);
to
$this->load->library('email');
$this->email->initialize($config);
You can check in details here.
Related videos on Youtube
Author by
PrakashT
Updated on June 04, 2022Comments
-
PrakashT almost 2 years
i tried to send the mail using codeigniter framework.but it will raise the error "Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
From: "prakash t" <[email protected]> Return-Path: <[email protected]> Reply-To: "[email protected]" <[email protected]> X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <[email protected]> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit =?UTF-8?Q?Test=20Mail?= hai this my test mail
" but no use
here is mycode:
public function sendMail(){
$config = Array( 'protocol' => 'mail', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 587, 'smtp_user' => '[email protected]', 'smtp_pass' => '*********' );
I know it's duplicate question.but i didn't find solution for my question
$this->load->library('email',$config); $this->email->set_newline("\r\n"); $this->email->from('[email protected]','prakash t'); $this->email->to('[email protected]'); $this->email->subject('Test Mail'); $this->email->message('hai this my test mail'); if($this->email->send()){ echo "mail send succesfully"; } else{ show_error($this->email->print_debugger()); } }
-
Saad Suri almost 6 yearsPossible duplicate of CodeIgniter unable to send email using PHP mail()
-
Mr. ED almost 6 years
'smtp_port' => 587
, should besmtp_port' => 465,
-
PrakashT almost 6 yearsi tried 587 and 465. but no use
-
Mr. ED almost 6 years@PrakashT Don't forget to accept answers that helped you meta.stackexchange.com/questions/5234/…
-
Bibhudatta Sahoo almost 6 yearsBro just accept my answer if your issue is solved with that !
-
-
Bibhudatta Sahoo almost 6 yearsYou are most welcome :) and now just close your question by accepting my answer by click the right button beside my answer
-
Bibhudatta Sahoo almost 6 yearsokay but you can just click the tick symbol near my answer so that my answer will be got accepted by you.
-
PrakashT almost 6 yearsBro i ask another question related this post pls help me bro stackoverflow.com/q/50187796/9658774