Question

Can't send email with codeigniter

Posted June 2, 2021 120 views
Email
$config['smtp_host'] = 'ssl://smtp.yandex.com.tr'; //change this
$config['smtp_port'] = '465';
$config['smtp_user'] = 'no_reply@example.com'; //change this
$config['smtp_pass'] = '*********'; //change this
$config['mailtype'] = 'html';
$config['smtp_timeout'] = 30;     
$config['charset'] = 'utf-8';   
$config['crlf'] = "\r\n";   
$config['newline'] = "\r\n";

$message = 'Hi there';
      $email = 'noname@gmail.com';
      $this->load->library("email");
        $result = $this->email`enter code here`
        ->from("no_reply@example.com", "Example.com")
        ->reply_to("no_reply@example.com", "Example.com")
        ->to($email)
        ->subject("Notification")
        ->message($message)
        ->send();
1 comment

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
2 answers

Already done but nothing changed

Hi there,

What is the exact error that you get when you try to send the email?

If you have a firewall, I could suggest making sure that you have port 465 open and also test the connection to smtp.yandex.com.tr on port 465, you can do that with the telnet command:

telnet smtp.yandex.com.tr 465

Regards,
Bobby