当我尝试通过PHPMailer(SMTP)从GoDaddy服务器发送邮件时,它显示500(内部服务器)错误。
我的代码是:
ini_set('display_errors', 1);
error_reporting(E_ALL);
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'SERVER.secureserver.net'; // Must be GoDaddy host name
$mail->SMTPAuth = true;
$mail->Username = 'EMAIL';
$mail->Password = 'PASSWORD';
$mail->SMTPSecure = 'tls'; // ssl will no longer work on GoDaddy CPanel SMTP
$mail->Port = 587; // Must use port 587 with TLS
$mail->setFrom('EMAIL', 'NAME');
$mail->addAddress('EMAIL', 'NAME');
$mail->Subject = 'Mail Subject';
$mail->Body = 'Mail Body';
$send = $mail->send();
?>
它返回500(内部服务器)错误。