Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
class.phpmailer.php中的SMTP错误_Php_Email_Smtp - Fatal编程技术网

class.phpmailer.php中的SMTP错误

class.phpmailer.php中的SMTP错误,php,email,smtp,Php,Email,Smtp,我已经下载了class.phpmailer.php、class.smtp.php和phpmailerautoad.php 错误:  2014-06-21 15:24:30 SMTP ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (4296) SMTP connect()

我已经下载了class.phpmailer.php、class.smtp.php和phpmailerautoad.php

错误:

    2014-06-21 15:24:30 SMTP ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (4296) SMTP connect() failed. Mailer Error: SMTP connect() failed. 
PHP代码,用于使用给定的$email、$subject和$body执行smtp电子邮件

<?php
    require_once("..\htmlphp\class.phpmailer.php");
    date_default_timezone_set('America/Eastern');
    include("..\htmlphp\class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
     $mail = new PHPMailer();
     $mail->IsSMTP(); // telling the class to use SMTP
     $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
                                       // 1 = errors and messages
                                       // 2 = messages only
     $mail->SMTPAuth   = true;                  // enable SMTP authentication
     $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
     $mail->Host       = "smtp.live.com";      
     $mail->Port       = 587;                            
     $mail->Username   = "self@live.com"; 
     $mail->Password   = "pass1"; 
     $mail->From="self@live.com";
     $mail->Subject    = $subject;
     $mail->Body=$body;
     $mail->AddAddress($email);
     //$mail->AddAttachment("images/phpmailer.gif");      // attachment
     //$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
     if(!$mail->Send()) {
          echo "Mailer Error: " . $mail->ErrorInfo;
     } else {
          echo "Message sent!";
     }
?>


您试图从哪个操作系统发送电子邮件?ssl使用端口465。tls使用587。