SMTP:无法连接套接字:无法找到套接字传输“ssl" [英] SMTP: Failed to connect socket: Unable to find the socket transport "ssl"
问题描述
我一直试图在 WAMP 上通过 GMail 发送带有 Pear 的电子邮件,在花了几个小时设置好一切并找出我遇到的所有错误之后,我想我非常接近,直到我开始收到此错误:
I've been trying to get to be able to send emails with Pear on WAMP through GMail, and after spending hours setting it all up and figuring out all the errors I was getting, I thought I was so close, until I started getting this error:
Failed to connect to ssl://smtp.gmail.com:465 [SMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )]
使用此代码:
<?php require_once "info.php"; require_once "Mail.php"; // info.php contains the variable $password
$from = "Me <myemail@gmail.com>";
$to = "Me <myemail@gmail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "myemail@gmail.com";
$password = "$password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
我在(正确的)php.ini 中检查并取消注释 extension=php_openssl.dll
,并确保 extension_dir
指向 DLL.我使用过 phpinfo();
并且我看到多次提到 SSL:
I've gone through and uncommented extension=php_openssl.dll
in the (correct) php.ini, and made sure that the extension_dir
was pointing to the DLLs. I've used phpinfo();
and I've seen multiple mentions of SSL:
我在 Loaded Modules
中看到 mod_ssl
.
在 mysqlnd
标题下有一个条目 SSL: supported
.
Under the mysqlnd
heading it has an entry SSL: supported
.
在 Phar
标题下有条目 Native OpenSSL support: enabled
.
And under the Phar
heading there's the entry Native OpenSSL support: enabled
.
我也关闭了我的防火墙,只是为了检查,我重新启动了我的电脑,我已经检查了这个网站上几乎所有像我一样的问题,但我仍然没有找到解决方案.
I've also turned off my firewall, just to check, I've restarted my computer, and I've checked practically every question like mine on this site, and I still haven't found a solution.
我不知道下一步该做什么.我需要启用/检查什么才能使其正常工作?
I'm at a loss of what to do next. What do I need to enable/check to get it working?
推荐答案
在防火墙中打开 smtp.gmail.com 的 465 端口 :)
Open up the Port 465 open to smtp.gmail.com in your firewall :)
那可能是你的主机有问题,否则,
Then there may be problem with your host or else,
试试这个 - 这是为我工作
您是否允许在 Gmail 中使用 SMTP
Did you allow SMTP in your Gmail
在 Gmail 设置中检查 SMTP 服务器的设置"是否处于活动状态.
Check that 'Settings' is active for the SMTP server in your Gmail Settings.
这篇关于SMTP:无法连接套接字:无法找到套接字传输“ssl"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!