Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php_network_getaddresses: getaddrinfo failed: No address associated with hostname (0) #340

Closed
romuloinnocencio opened this issue Dec 31, 2014 · 1 comment

Comments

@romuloinnocencio
Copy link

2014-12-30 23:54:03 SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: No address associated with hostname (0)
SMTP connect() failed.

What's this means?

I try to my domain, jscomunicacaovisual.com;
I created a email. contato@jscomunicacaovisual.com


require_once('class.phpmailer.php');

/*abaixo as veriaveis principais, que devem conter em seu formulario*/
$nomeDestinatario = 'JS Comunicação Visual';
$destinatarios = 'contato@jscomunicacaovisual.com';
$usuario = 'contato@jscomunicacaovisual.com';
$senha = '*********';

/*********************************** A PARTIR DAQUI NAO ALTERAR ************************************/

$To = $destinatarios;
$Subject = $assunto;
$Message = $dados;

$Host = 'smtp.'.substr(strstr($usuario, '@'), 1);

$Username = $usuario;
$Password = $senha;
$Port = "587"; 

$mail = new PHPMailer();
$body = $dados;

$mail->CharSet = 'UTF-8';

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = $Host; // SMTP server
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = $Port; // set the SMTP port for the service server
$mail->Username = $Username; // account username
$mail->Password = $Password; // account password

$mail->SetFrom($usuario, $nomeDestinatario);
$mail->Subject = $Subject;
$mail->MsgHTML($body);
$mail->AddAddress($To,'');

/* ENVIO */

if( !$mail -> Send() ){
    return mail;
} else { 
    return 1;
}
@Synchro
Copy link
Member

Synchro commented Jan 1, 2015

It means that either the address you are trying to connect to does not have a DNS entry, or your DNS is not working. Please read the troubleshooting guide. You also need to update your PHPMailer.

@Synchro Synchro closed this as completed Jan 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants