GMail fsockopen(): SSL operation failed error with Codeigniter and XAMPP

In my case, the Avast Antivirus was blocking the port. I was using the SMTP port 465 for sending an email from my CodeIgniter project. It showed an error:

fsockopen() failed to enable crypto

Simply disabling the Avast Antivirus solved the problem.

Alternative 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

Leave a Comment