<?php
//error_reporting(E_ALL);
error_reporting(E_STRICT);
require_once('/PHPMailer/class.phpmailer.php');
$mail=new PHPMailer();
$body='blah body';
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host="127.17.7.4"; // SMTP server
$mail->Port=25;
$mail->SMTPDebug=1; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SetFrom('name@zenphoto.com', 'First Last');
$mail->AddReplyTo("name@zenphoto.com","First Last");
$address = "myemail@email.com"; //This will be my email address, that I want to receive the mail on
$mail->AddAddress($address);
$mail->Subject = "PHPMailer Test Subject via mail(), basic";
$mail->MsgHTML($body);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
我正在尝试使用 PHPMailer 发送邮件,但我不断收到错误消息:确切的错误消息:
SMTP -> ERROR: Failed to connect to server: 连接尝试失败,因为连接方在一段时间后没有正确响应,或者连接失败,因为连接的主机没有响应。(10060)
以下发件人地址失败:name@zenphoto.com:调用 Mail(),但未连接邮件程序错误:以下发件人地址失败:name@zenphoto.com:调用 Mail(),但未连接