2

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' => 'example@gmail.com',
            'smtp_pass' => $pass,
            'charset' => 'utf-8',
            'newline' => "\r\n"
        );


        $this->load->helper('string');
        $this->load->library('email',$config);

        $this->email->from('example@yahoo.com', 'Mr. Duterte');
        $this->email->to('example2@yahoo.com');

        $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)

Mike
  • 23,542
  • 14
  • 76
  • 87
aronccs
  • 274
  • 3
  • 12
  • 30
  • Does this help? http://stackoverflow.com/questions/1555145/sending-email-with-gmail-smtp-with-codeigniter-email-library – Mike May 07 '16 at 03:50

3 Answers3

3

I have figured out the problem. I just turned off my antivirus (Avast).

aronccs
  • 274
  • 3
  • 12
  • 30
0

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

elazafran
  • 21
  • 3
  • 1st solution was a success, However the alternative solution is not valid anymore as Avast application has updated its UI and is not there anymore (Avast version: 20.10.2442) – Abdulaziz Hamdan Jan 15 '21 at 09:48
0

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.

sam53
  • 58
  • 10