我一直试图通过GMail在WAMP 上发送带梨的电子邮件,并花费数小时完成设置后,找出所有我得到的错误,我想我是如此接近,直到我开始收到此错误:SMTP:无法连接套接字:无法找到套接字传输“SSL”
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 <[email protected]>";
$to = "Me <[email protected]>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "[email protected]";
$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>");
}
?>
我已经经历了,并取消注释extension=php_openssl.dll
在(正确的)php.ini,a nd确保extension_dir
指向DLL。我已经使用phpinfo();
,我已经看到多次提到SSL:
我看mod_ssl
在Loaded Modules
。
下mysqlnd
标题它有一个入口SSL: supported
。
而且Phar
标题下有入门Native OpenSSL support: enabled
。
我也关闭了我的防火墙,只是为了检查,我重新启动我的电脑,我已经检查几乎像在这个网站矿的每一个问题,我还没有找到一个解决方案。
我不知道下一步该做什么。我需要启用/检查才能使其工作?
我附近,我有我的防火墙完全脱落到底说了。无论如何,我尝试过,但它没有奏效。 –
我没有使用Ubuntu(尽管我拥有它),我使用的是Windows 7.我还检查了GMail中的所有设置,并且一切都很顺利。感谢您花时间,我希望我能弄明白这一点。:) –
Niceeee,谢谢解决我的问题 – Flappy