我正在尝试使用phpmailer发送电子邮件,它在我的笔记本电脑上使用xampp localhost服务器工作正常,但当我试图在我的Windows服务器2008上运行php类时,安装了wamp它没有用。 我已经检查过是否从php.ini
启用了ssl我收到了这个错误:
2016-09-06 10:01:22连接:打开smtp.mail.yahoo.com:587,timeout = 300,options = array()2016-09-06 10:01:44 SMTP错误:失败连接到服务器:连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接主机无法响应而建立连接失败。 (10060)2016-09-06 10:01:44 SMTP connect()失败。无法发送https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting消息.Mailer错误:SMTP connect()失败。 https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 这是我的代码:
SendOutlook();
function SendOutlook(){
//$recipient = 'alghomlas.dk@pg.com';
require 'PHPMailer/PHPMailerAutoload.php';
$Emp_recipient = "alghomlas.dk@pg.com";
$mail = new PHPMailer;
$mail->SMTPDebug = 4; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = "smtp.mail.yahoo.com"; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'xxxxxxxxx'; // SMTP username (server username)
$mail->Password = 'xxxxx'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('alghomlas.dk@yahoo.com', 'One');
$mail->addAddress($Emp_recipient,"dalal alghomlas"); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'test';
$mail->Body = "scheduled on your outlook calender";
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit();
}else {
echo '<p>Message has been sent</p>';
}
echo !extension_loaded('openssl')?"Not Available":"Available";
AddOutlookEvent($Mng_recipient, $Emp_recipient, $Mng_Name, $Emp_Name, $Date, $Time);
}