I am trying to send an email in CodeIgniter 4 and I can't understand what am I doing wrong. Here is my code.
$post_params = $this->request->getPost();
$post_params = $this->db->escape($post_params);
$config['mailType'] = 'html';
// send mail to company
$send_email = \Config\Services::email();
$send_email->clear();
$send_email->initialize($config);
$send_email->setFrom('noreply@yourjob.am', 'YourJob.am | Աշխատանքային հայտարարությունների հարթակ');
$send_email->setTo($post_params['mail']);
$send_email->setSubject($post_params['subject']);
$email_html = $post_params['message'];
$send_email->setMessage($email_html);
$send_email->send();
When I am checking errors there is no errors and in console it says "Email successfully sent"
if ($send_email->send())
{
echo 'Email successfully sent';
}
else
{
$data = $send_email->printDebugger(['headers']);
print_r($data);
}
I also have tried regular php mail() function but no results.