Page 1 of 1

Swift with gmail

Posted: Fri Jul 14, 2006 1:35 am
by shiznatix
Im trying out this handy dandy switft stuff but I can't get it to work with gmail. it says that i need to enable somthing in my php.ini file but i have no idea what. here is the error I get:
fsockopen() [function.fsockopen]: unable to connect to tls://smtp.gmail.com:465 (Unable to find the socket transport "tls" - did you forget to enable it when you configured PHP?)

Posted: Fri Jul 14, 2006 4:10 am
by Chris Corbyn
PHP needs to be compiled with OpenSSL support for TLS to work. It also doesn't exists *at all* in PHP < 4.3.0

Posted: Fri Jul 14, 2006 4:20 am
by shiznatix
ok now when i try to connect it just times out after like 15 seconds. it's like this:

Code: Select all

//this works
$thing = file_get_contents('http://www.google.com');
dump($thing);

//this times out
$mailer = $this->LoadExtension('Swift', array('ConnectionType' => 'gMail'));
my loading of swift:

Code: Select all

require('./Extensions/Swift/Swift.php');
require('./Extensions/Swift/Swift/Swift_SMTP_Connection.php');

$swift = new Swift(new Swift_SMTP_Connection('smtp.gmail.com', SWIFT_SECURE_PORT, SWIFT_TLS));
the error:
fsockopen() [function.fsockopen]: unable to connect to tls://smtp.gmail.com:465 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. )

Posted: Fri Jul 14, 2006 4:32 am
by Chris Corbyn
Can you show me a phpinfo() output? :)

Posted: Fri Jul 14, 2006 4:58 am
by shiznatix
just sent you a pm of the html of phpinfo() because i don't have a website right now and everything is being done locally.

Posted: Fri Jul 14, 2006 5:35 am
by Chris Corbyn
Says TLS is a registered stream... hmm.. Not too sure on this :? I've had one other developer contact me having difficulty getting TLS to work on windows and he said something about needing the static binaries for OpenSSL for it to work but I'm not 100% on that. The odd thing is that the error you're getting seems to suggest it's Gmail that's not responding but I doubt that.

Not sure it makes much difference but Gmail is using the Thawte Root Ca certificate... perhaps OpenSSL for windows does not include that cert so you may need to include it yourself.

Posted: Fri Jul 14, 2006 5:38 am
by shiznatix
where do i get this certificate and how do i include it myself? i don't know very much about certificates and whatnot.

Posted: Fri Jul 14, 2006 5:39 am
by Chris Corbyn
shiznatix wrote:where do i get this certificate and how do i include it myself? i don't know very much about certificates and whatnot.
I'll PM you about that.