【问题标题】:phpmailer script on godaddy is not working [duplicate]Godaddy上的phpmailer脚本不起作用[重复]
【发布时间】:2018-04-28 17:44:58
【问题描述】:

SMTP 错误:无法连接到服务器:php_network_getaddresses:getaddrinfo 失败:名称或服务未知 (0) 2017-11-15 13:11:07 SMTP connect() 失败。

<?php
require 'PHPMailerAutoload.php';
//echo !extension_loaded('openssl')?"Not Available":"Available <br/>";

$email = $_POST['email'];
$number = $_POST['phone'];
$client = $_POST['client'];

$to = 'myemailid@gmail.com';
$subject = 'user registration';
$phone = "phone number:".$number;
$message = "client details:"."\n"."email:".$email."\n"."phone number:".$number."\n"."client:".$client;
$headers = "From:".$email;

$mail = new PHPMailer;

$mail->SMTPDebug = 0;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'hosting.secureserver.net';       //  ssl://smtp.gmail.com          // Specify main and backup SMTP servers
$mail->SMTPAuth = false;                               // Enable SMTP authentication
$mail->Username = '';                      // SMTP username
$mail->Password = '';                    // SMTP password

$mail->From = 'myemailid@gmail.com';

$mail->SMTPSecure = 'none';  //TLS                      // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25;          //587                          // TCP port to connect to

$mail->setFrom($email);
$mail->addAddress($to);
$mail->Subject = $subject;
$mail->Body    = $message;

if($mail->send()) {
    header("Location: ../../thankyou.html");
}
else {
    echo $mail->ErrorInfo;
    //header("Location: ../../error.html");
}
?>

这是我收到的错误,因为我是这个 php 的新手,任何详细的解释将不胜感激。谢谢

【问题讨论】:

  • 发帖前先搜索。 GoDaddy 对出站电子邮件有非常严格的规定;它们在这里出现过很多次,并且在错误消息链接的 PHPMailer 故障排除指南中有所提及。

标签: email server phpmailer shared-hosting fault


【解决方案1】:

主机hosting.secureserver.net 不存在。您需要为出站 SMTP 服务器设置正确的服务器和凭据。此信息应由托管您的电子邮件服务的任何人提供 - 可能是您的网络主机。

【讨论】:

  • 试过但没有成功
  • SMTP 错误:无法连接到服务器:连接被拒绝 (111) 2017-11-15 15:04:28 SMTP connect() 失败。仍然收到此错误
猜你喜欢
  • 2017-11-02
  • 2019-01-07
  • 2021-07-16
  • 2017-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-02
相关资源
最近更新 更多