Answers for "codeigniter Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."

PHP
0

codeigniter Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.

?php

 class Notification_model extends CI_Model {

 public function send_notification_email($link){

 $emails = $this->get_all_emails();

 $this->load->helper('email');
 $this->load->library('email');

 $config['protocol']    = 'smtp';
 $config['smtp_host']    = 'lax09.web.com.ph';
 $config['smtp_port']    = '465';
 $config['smtp_auth']    = true;
 $config['smtp_timeout'] = '7';
 $config['smtp_user']    = $this->config->item('admin_email');
 $config['smtp_pass']    = $this->config->item('admin_pass');
 $config['charset']    = 'utf-8';
 $config['newline']    = "\r\n";
 $config['mailtype'] = "html";
 $config['validation'] = TRUE;
 $this->email->initialize($config);


 $this->email->from($this->config->item('admin_email') , 'Sample Sender');
 $this->email->to($emails);
 $this->email->subject('Good day');

 $message = '
       <!DOCTYPE html>
       <html lang="en">';
 $message .= '<p>Hello Everyone,</p>';
 $message .= '<p>We have news for you, just click the link below for details.</p>';
 $message .= '<p><a href="'.$link.'">Click here! </a></p>';
 $message .= '<p>Thank you,</p>';
 $message .= '<p>Sample Sender</p>';
 $message .= '</body></html>';

 $this->email->message($message);
  if ( ! $this->email->send())
         {
           echo "<pre>".$this->email->print_debugger() ."</pre>";
         }
         else{
           return TRUE;
         }
   }

public function get_all_emails(){
  $query = $this->db->get('accounts');
  $emails = array();
  foreach($query->result() as $row){
    $emails[] = $row->email;
  }
  return $emails;
}
  }
Posted by: Guest on September-15-2021

Code answers related to "codeigniter Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method."

Browse Popular Code Answers by Language