I have hosted my domain on amazon ec2 and i have added outbound rules for https (465) and custom tcp (587).
below are my email configuration
$config['email_config'] = [
'mailtype' => 'html',
'protocol' => 'smtp',
'smtp_host' => 'ssl://email-smtp.ap-south-1.amazonaws.com',
'smtp_port' => '587',
'smtp_user' => 'AKIAZJ2TDSA******',
'smtp_pass' => 'B*****N/aBD2mH3nWT4DiOfJ9NI3NRh*******',
'smtp_crypto' => 'tls',
'newline' => "\r\n"
];
And below are email sending code
$this->email->clear();
$this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
$this->email->reply_to($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
$this->email->to('k3@vaksys.com');
$this->email->subject('test subject');
$this->email->message("test");
if ($this->email->send())
{
// echo $this->email->print_debugger();
echo ' sent';
}
else
{
echo 'not sent';
}
According above code, it always goes to if condition.