CodeIgniter Forums

Full Version: fsockopen problem with email class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I've only recently started using CodeIgniter, so apologies if this is a common problem or anything. I did try searching and found a few vaguely related topics, but none of them solved the issues I'm having.

I'm trying to send a simple email when a user fills out a contact form on my website, it all works perfectly when I'm working locally on my PC, but when I transfer the site to my web hosting I get this error when it's trying to send the email:

A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to (Connection timed out)

Filename: libraries/Email.php

Line Number: 1652

I assume this error is because my host disable fsockopen, so does anyone know an easy-ish fix for this?


El Forum

Actually, I'm also having the same thing happening, but randomly... sometimes it works perfectly, other times it does not!

Any ideas ?


El Forum

Can u show u'r controller code...

El Forum

I've sorted it now. I had the "smtp_host" in my email config file set to my domain ( but for some reason the server didn't like that. Changed the smtp server address to localhost (in the mail config file) and it now works perfectly Smile

El Forum