GMail Issue
Posted: Tue Apr 17, 2007 4:23 am
I used the following code to access my gmail account:
and the following error message appeared:
Fatal error:
Uncaught Error of type [swift_connection_exception] with message [The SMTP connection failed to start [tls://smtp.gmail.com:465]: fsockopen returned Error Number 111 and Error String 'Connection refused']
My openssl is enabled on my php installation, so I am not sure why I can't connect. Any ideas?
Code: Select all
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
//Connect to Gmail (PHP4)
$smtp =& new Swift_Connection_SMTP("smtp.gmail.com", SWIFT_SMTP_PORT_SECURE, SWIFT_SMTP_ENC_TLS);
$smtp->setUsername("californiaswap@gmail.com");
$smtp->setPassword("*****");
$swift =& new Swift($smtp);
//Create the message
$message =& new Swift_Message("My subject", "My body");
//Now check if Swift actually sends it
if ($swift->send($message, "bpirtle@gmail.com", "californiaswap@gmail.com")) echo "Sent";
else echo "Failed";Fatal error:
Uncaught Error of type [swift_connection_exception] with message [The SMTP connection failed to start [tls://smtp.gmail.com:465]: fsockopen returned Error Number 111 and Error String 'Connection refused']
My openssl is enabled on my php installation, so I am not sure why I can't connect. Any ideas?