我在Google上搜索如何在很长时间内发生这个错误。我试过this主题的所有解决方案都没有运气。 <? phpinfo(); ?>
(我使用Appserver而不是IIS的唯一区别)它没有显示与SSL相关的任何内容。我还应该尝试什么?无法找到套接字传输“ssl” - 您是否忘记在配置PHP时启用它?
完整的错误消息:
<b>Warning</b>: fsockopen() [<a href='function.fsockopen'>function.fsockopen</a>]: unable to connect to ssl://smtp.gmail.com:465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in <b>C:\AppServ\www\webgitz\test\class.smtp.php</b> on line <b>122</b><br />
SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (27010016)
和代码:
<?php
require_once "validation.php";
require_once "PHPMailer.php";
require_once "class.smtp.php";
$email= "[email protected]";
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port =465; // set the SMTP server port
$mail->Host = "smtp.gmail.com"; // GMAIL's SMTP server
$mail->SMTPDebug = 2;
$mail->SMTPSecure = 'ssl';
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "*********"; // GMAIL password
$mail->AddReplyTo("[email protected]","AAAA"); // Reply email address
$mail->From = "[email protected]";
$mail->FromName = "...."; // Name to appear once the email is sent
$mail->Subject = "...."; // Email's subject
$mail->Body = "Hello World,<br />This is the HTML BODY<br />"; //HTML Body
$mail->AltBody = "..."; // optional, commentA out and test
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($msg); // [optional] Send body email as HTML
$mail->AddAddress("$email", "fooo"); // email address of recipient
$mail->IsHTML(true); // [optional] send as HTML
if(!$mail->Send()) echo 'ok'; else echo 'error';
?>
[未启用PHP中的套接字传输“ssl”的可能的重复](http://stackoverflow.com/questions/1705856/socket-transport-ssl-in-php-not-enabled) –
@ShankarDamodaran:阅读话题我说我已经试过 – Jack
你能发布一个链接到phpinfo()的结果吗? – PatomaS