我的代码是否正确或为sitemailxchange主机和端口号提供了一些建议..?我检查了大部分组合。 提前致谢。
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
//$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.sitemailxchange.gate.com";
$mail->Port = 587;
$mail->Username = "yourmail@domain.com";
$mail->Password = "password";
$mail->SetFrom('yourmail@domain.com');
$mail->AddReplyTo("yourmail@domain.com");
$mail->Subject = "PHPMailer Test Subject via smtp (Gmail), basic";
$mail->AltBody = "To view the message, viewer!";
$mail->MsgHTML($body);
$address = "yourmail@domain.com";
$mail->AddAddress($address, "John Doe");
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}