Reputation: 294
I am having trouble sending email. I don't know what to do. I already un-commented the extension=php_openssl.dll in php.ini file, but I still receive this error.
Here is my code:
function send_email(){
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smpt_timeout' => '30',
'smtp_user' => '[email protected]',
'smtp_pass' => $pass,
'charset' => 'utf-8',
'newline' => "\r\n"
);
$this->load->helper('string');
$this->load->library('email',$config);
$this->email->from('[email protected]', 'Mr. Duterte');
$this->email->to('[email protected]');
$this->email->subject('DU30');
$this->email->message('change is coming');
//.base_url().'item/'.random_string
if( $this->email->send()){
echo "Success";
}else{
echo "Fail";
}
}
And I am getting three errors:
First:
"fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed"
Second:
fsockopen(): Failed to enable crypto
Third:
fsockopen(): unable to connect to ssl://smtp.googlemail.com:465 (Unknown error)
Upvotes: 3
Views: 6526
Reputation: 58
I'm getting the same issue on the nginx server. Upgraded OpenSSL to 1.1.1 but still the same. On my laptop, I'm using Kaspersky but in my case antivirus is not making any issues on the server.
Upvotes: 0
Reputation: 21
Avast Antivirus was blocking the port. I was using the SMTP port 465 for sending an email from CodeIgniter project:
fsockopen() failed to enable crypto
Simply disabling the Avast Antivirus solved the problem.
Another Solution but if you want to keep your Avast security on, you should:
Open Avast
Click on Settings (upper right corner of page)
Click on Troubleshooting
Click on Redirect Settings
Clear the port you used from Redirect Settings's MAIL section
Click OK
Close Avast
Upvotes: 0
Reputation: 294
I have figured out the problem. I just turned off my antivirus (Avast).
Upvotes: 3