Bluehost不发送我的电子邮件,但在本地主机上完全正常
创始人
2024-12-23 01:30:25
0

这个问题可能是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服务器。

相关内容

热门资讯

五分钟了解(Wepoke后台)... 您好,Wepoke后台这款游戏可以开挂的,确实是有挂的,需要了解加微【136704302】很多玩家在...
两分钟了解(aapokeR)外... 两分钟了解(aapokeR)外挂透明挂辅助下载(透视)2025新版教程(2026已更新)(哔哩哔哩)...
第三分钟了解(众合推扑克)外挂... 第三分钟了解(众合推扑克)外挂透明挂辅助软件(透视)揭秘教程(2025已更新)(哔哩哔哩);第三分钟...
5分钟了解(菠萝德州app)外... 5分钟了解(菠萝德州app)外挂透明挂辅助安装(透视)透明教程(2026已更新)(哔哩哔哩);5分钟...
一分钟了解(AAPOKEr)软... 一分钟了解(AAPOKEr)软件透明挂辅助软件(透视)wpk教程(2020已更新)(哔哩哔哩);wp...
2分钟了解(德扑手机上)软件透... 2分钟了解(德扑手机上)软件透明挂辅助app(透视)安装教程(2021已更新)(哔哩哔哩);德扑手机...
5分钟了解(德州poker)黑... 5分钟了解(德州poker)黑科技透明挂辅助代打(透视)透明教程(2026已更新)(哔哩哔哩);最新...
第3分钟了解(扑克世界app)... 第3分钟了解(扑克世界app)黑科技透明挂辅助ai(透视)2025新版教程(2026已更新)(哔哩哔...
四分钟了解(WPK控制)外挂透... 四分钟了解(WPK控制)外挂透明挂辅助插件(透视)AI教程(2026已更新)(哔哩哔哩);人气非常高...
第1分钟了解(wepoke德州... 第1分钟了解(wepoke德州扑克)外挂智能ai辅助软件(透视)必赢方法(2022已更新)(哔哩哔哩...