我正在开发一个网站,使用phpmailer向我公司的员工发送提醒,电子邮件工作正常,但当我连接到工作场所的互联网连接时,它停止工作,没有错误,但: 连接:打开到smtp.mail.yahoo.com:587,timeout = 300,options = array()
我猜它可能是一个封闭的端口,所以我尝试使用587和25。 我在网络方面不是很好,有什么方法可以让我知道确切的错误是什么?
function SendOutlook(){
//$recipient = 'xxxxx@yahoo.com';
require 'PHPMailer/PHPMailerAutoload.php';
$Emp_recipient = "employee@yahoo.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 = 'xxxxx@yahoo.com'; // 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('xxxxx@yahoo.com', 'One');
$mail->addAddress($Emp_recipient,"name"); // 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";
}