0

SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0) 2017-11-15 13:11:07 SMTP connect() failed.

<?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");
}
?>

this is the error i am receiving, as i am new to this php any detailed explanation would be highly appreciated. thank you

vihar
  • 19
  • 5
  • Search before you post. GoDaddy has very strict rules on outbound email; they have come up on here many times, and are mentioned in the PHPMailer troubleshooting guide that is linked from the error message. – Synchro Nov 15 '17 at 13:26

1 Answers1

0

The host hosting.secureserver.net does not exist. You need to set the correct server and credentials for the outbound SMTP server. This information should be provided by whoever is hosting your email services - probably your web host.

Polynomial
  • 27,674
  • 12
  • 80
  • 107