Hi
I'm really hoping for some ideas!
I have been setting up phpmailer on my server and it was working nicely on my local server so I uploaded to my live server and tested. The mystery is that it times out.
The timeout occurs with fsockopen(). I have checked the php configuration line by line and I can't find anything in the live server setup that is different from the local which might affect it. Could gmail have black-listed my domain/server or something?
Here is my test code and the output - first from the local server and second from the live. You can see the difference. Any clues?!
Thanks in advance!!!
[PHP]
<?php
echo '<h1>Testing SSL and TLS connections to gmail.com</h1>';
ini_set('max_ex ecution_time',1 50);
$security=array ('tls','ssl');
$ports=array(46 5,587);
$c=0;
foreach ($security as $suf) {
foreach ($ports as $p) {
++$c;
echo "<h3>$c</h3>";
$host= ($suf=='ssl') ? "$suf://smtp.gmail.com" : "smtp.gmail.com ";
if (fsockopen($hos t,$p,$errorno,$ errormsg,10)) {
echo "Connected using $suf and port $p";
}
else {
echo "Using $suf and port $p caused an error ($errorno): <br />$errormsg<hr /><hr />";
}
}
}
echo "Done";
?>
[/PHP]
Local server output:
[code=text]
Testing SSL and TLS connections to gmail.com
1
Connected using tls and port 465
2
Connected using tls and port 587
3
Connected using ssl and port 465
4
( ! ) Warning: fsockopen() [function.fsocko pen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC: SSL routines:func(1 19):reason(252)
( ! ) Warning: fsockopen() [function.fsocko pen]: Failed to enable crypto
( ! ) Warning: fsockopen() [function.fsocko pen]: unable to connect to ssl://smtp.gmail.com: 587 (Unknown error)
[/code]
Live server output:
[code=text]
Testing SSL and TLS connections to gmail.com
1
Using tls and port 465 caused an error (110):
Connection timed out
2
Using tls and port 587 caused an error (110):
Connection timed out
3
Using ssl and port 465 caused an error (110):
Connection timed out
4
Using ssl and port 587 caused an error (110):
Connection timed out
Done
[/code]
I'm really hoping for some ideas!
I have been setting up phpmailer on my server and it was working nicely on my local server so I uploaded to my live server and tested. The mystery is that it times out.
The timeout occurs with fsockopen(). I have checked the php configuration line by line and I can't find anything in the live server setup that is different from the local which might affect it. Could gmail have black-listed my domain/server or something?
Here is my test code and the output - first from the local server and second from the live. You can see the difference. Any clues?!
Thanks in advance!!!
[PHP]
<?php
echo '<h1>Testing SSL and TLS connections to gmail.com</h1>';
ini_set('max_ex ecution_time',1 50);
$security=array ('tls','ssl');
$ports=array(46 5,587);
$c=0;
foreach ($security as $suf) {
foreach ($ports as $p) {
++$c;
echo "<h3>$c</h3>";
$host= ($suf=='ssl') ? "$suf://smtp.gmail.com" : "smtp.gmail.com ";
if (fsockopen($hos t,$p,$errorno,$ errormsg,10)) {
echo "Connected using $suf and port $p";
}
else {
echo "Using $suf and port $p caused an error ($errorno): <br />$errormsg<hr /><hr />";
}
}
}
echo "Done";
?>
[/PHP]
Local server output:
[code=text]
Testing SSL and TLS connections to gmail.com
1
Connected using tls and port 465
2
Connected using tls and port 587
3
Connected using ssl and port 465
4
( ! ) Warning: fsockopen() [function.fsocko pen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC: SSL routines:func(1 19):reason(252)
( ! ) Warning: fsockopen() [function.fsocko pen]: Failed to enable crypto
( ! ) Warning: fsockopen() [function.fsocko pen]: unable to connect to ssl://smtp.gmail.com: 587 (Unknown error)
[/code]
Live server output:
[code=text]
Testing SSL and TLS connections to gmail.com
1
Using tls and port 465 caused an error (110):
Connection timed out
2
Using tls and port 587 caused an error (110):
Connection timed out
3
Using ssl and port 465 caused an error (110):
Connection timed out
4
Using ssl and port 587 caused an error (110):
Connection timed out
Done
[/code]
Comment