Why is the email not being sent?

Email is not sent, here is the code (Codeigniter)

$this->email->to("[email protected]");
$this->email->subject("Feedback ");

Well, what configuration should I do? When I write my email (hotmail) in the form, everything shows correctly, and a message comes to the email (the email that was indicated in the form) that it was not sent. Where is the mistake? Thank you.

Answer 1, authority 100%

See the error message that is returned to your email for a start. What is written there, that the addressee was not found, or that the addressee’s mail is full, or something else. And from this dance already. If the script didn’t send, then you would get an error in the script, and so it turns out that the sending works, but it doesn’t reach the final one, so look for an error in the address or something like that.

Answer 2, authority 100%

  1. Use a separate function:

    function _email($from, $to, $subject, $message)
        //$site_name = config_item('site_name');
        $site_name = 'hashcode.ru';
        $this->email->initialize(array('useragent' => $site_name, 'mailtype' => 'html'));
        $this->email->from($from, $site_name)->to($to)->subject($subject)->message($message);
        if ($this->email->send()) return TRUE;
        else return FALSE;
  2. Where you need to send, in the function you write like this:

    $this->_email('[email protected]', '[email protected]', '', '');