PHP邮件问题Godaddy托管

时间:2020-05-06 05:37:04

标签: php phpmailer

我有一个我创建的网站,与我们联系页面,我想向用户发送邮件。我已经制作了php邮件程序代码,但是当我提交“联系我们”按钮时,问题就来了(SMTP错误:无法连接到SMTP主机。)请帮助我做错了。

我的PHP邮件代码:

$mail = new PHPMailer;
  $mail->IsSMTP(); 
  $mail->SMTPDebug = 0;  
  $mail->SMTPAuth  = true; 
  $mail->SMTPSecure = 'ssl';
  $mail->Host     = "smtpout.secureserver.net";
  $mail->Port     = 465;
  $mail->SMTPAuth = true;
  $mail->Username = "what is the username";
  $mail->Password = "what is the password";
  $mail->setFrom('mail@sell.com', 'Raja');
  $mail->addAddress($email , $name);
  $mail->isHTML(true);
  $mail->send();

1 个答案:

答案 0 :(得分:1)

  1. 您正在使用GoDaddy
  2. 您正在使用GoDaddy不支持的加密
  3. 您正在使用GoDaddy不支持的身份验证
  4. 您已禁用调试输出,因此您对正在发生的事情没有任何反馈,尽管如果服务器不支持将ssl模式用于端口465时您不会得到很多帮助
  5. 您没有进行错误检查,因此也不知道它的中断位置-您的代码基于the examples provided with PHPMailer
  6. 您正在使用旧版本的PHPMailer; get the latest
  7. 您还没有阅读the PHPMailer troubleshooting guide关于GoDaddy的评论
  8. 您不是search before you posted