这个问题可能是Bluehost的SMTP服务器没有正确配置所导致的。你可以将脚本中的SMTP服务器更改为以下内容,以确保重试发送您的电子邮件:
// Replace this with your own email
$to = "youremail@email.com";
// Replace this with the subject of the email
$subject = "Subject of the email";
// Replace this with the body of the email
$body = "Body of the email";
// Replace this with your own email address
$from = "youremail@email.com";
require_once("phpmailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 1; // Debugging purposes only
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com"; // Replace this with your SMTP server
$mail->Port = 465; // Typically 587, but may vary
$mail->Username = "yourusername";
$mail->Password = "yourpassword";
$mail->SetFrom($from);
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}
确保替换以下内容以符合您的WordPress站点上的设置:
将 $to 和 $from 更改为您要发送电子邮件的电子邮件地址。
将 $subject 更改为电子邮件的主题。
将 $body 更改为电子邮件的内容。
将 Host 更改为您的SMTP服务器。
上一篇:Bluehost: PHPMailer 将已发送的邮件保存在“已发送项目”中
下一篇:Bluehost出现“TooManyConnectionsErrorAlthoughthereisNoTraffic”