Fix “PHP Warning: fsockopen() ” Error in Opencart in cPanel & CSF

If you are using Opencart on a VPS or dedicated server and you have cPanel/WHM with Configserver Firewall (CSF) installed, you may encounter a problem when sending email.

If you check error log, you may see the similar error.

PHP Warning: fsockopen()  [function.fsockopen'>function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) in /home/XXXX/public_html/www.example.com/system/library/mail.php on line 153

You may try the following fix.

1. Logon to WHM & browse to ConfigServer Security & Firewall page.

2. Click on “Firewall Configuration” button

3. Find “SMTP_ALLOWUSER” option.

4. In the field add your cPanel username. If the is multiple username use comma to separate.

5. Click “Change” and Restart Configserver Firewall

This guide may fix other program such as Interspire Email Marketer as well.

Live Domain & Mail / Hotmail SMTP Settings in phpMyDirectory

phpMyDirectory is one of the best web directory scripts that I used. Fortunately, you can use your existing hotmail account in phpMyDirectory. In fact it is not limited to only hotmail, but to all free email service provided by Microsoft including live mail, msn mail, outlook.com email and even Live Domain.

To ensure it work, correct SMTP Server details are required.

Email setting page can be found by browsing

Setup → Settings  Email

The table below is the setting for using hotmail, live mail, msn mail, outlook.com email and Live Domain.

Hotmail / Live / MSN/ Outlook Live Domain
Send email with SMTP SMTP
SMTP Server smtp.live.com smtp.live.com
SMTP User <your email>@<domain> <your email>@<your domain>
SMTP Password <your password> <your password>
SMTP Port 587 587
SMTP Authentication Yes Yes
SMTP Encryption  TLS TLS