如何修复GoDaddy服务器500(内部服务器)上发送PHPMailer SMTP邮件的错误

时间:2019-01-30 19:41:49

标签: php smtp phpmailer

当我尝试通过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(内部服务器)错误。

0 个答案:

没有答案