0 votes
in CodeIgniter by
How to Send email by using codeigniter library via localhost

1 Answer

0 votes
by
Use the below code to send email by using codeIgniter

function sendMail()

{

    $config = Array(

  'protocol' => 'smtp',

  'smtp_host' => 'ssl://smtp.googlemail.com',

  'smtp_port' => 465,

  'smtp_user' => '[email protected]', // change it to yours

  'smtp_pass' => 'xxx', // change it to yours

  'mailtype' => 'html',

  'charset' => 'iso-8859-1',

  'wordwrap' => TRUE

);

        $message = '';

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

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

      $this->email->from('[email protected]'); // change it to yours

      $this->email->to('[email protected]');// change it to yours

      $this->email->subject('Resume from JobsBuddy for your Job posting');

      $this->email->message($message);

      if($this->email->send())

     {

      echo 'Email sent.';

     }

     else

    {

show_error($this->email->print_debugger());

    }

}

Related questions

0 votes
asked Dec 4, 2020 in Testing by sharadyadav1986
0 votes
asked Dec 30, 2020 in CodeIgniter by SakshiSharma
...