Welcome Guest, Not a member yet? Register   Sign In
fsockopen problem with email class
#1

[eluser]Unknown[/eluser]
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:

Code:
A PHP Error was encountered

Severity: Warning

Message: fsockopen() [function.fsockopen]: unable to connect to mail.mydomainname.com:25 (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?

Thanks
#2

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

Any ideas ?

Thanks!
#3

[eluser]mi6crazyheart[/eluser]
@Tiestarian
Can u show u'r controller code...
#4

[eluser]Unknown[/eluser]
I've sorted it now. I had the "smtp_host" in my email config file set to my domain (mail.domainname.com)... 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
#5

[eluser]mi6crazyheart[/eluser]
Great...




Theme © iAndrew 2016 - Forum software by © MyBB