Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] Error Con php mail

Estas en el tema de Error Con php mail en el foro de PHP en Foros del Web. Estoy usando el siguiente codigo pero no puedo conectarme al smtp por el siguiente error SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo ...
  #1 (permalink)  
Antiguo 09/07/2013, 10:59
 
Fecha de Ingreso: marzo-2013
Mensajes: 52
Antigüedad: 11 años, 1 mes
Puntos: 0
Error Con php mail

Estoy usando el siguiente codigo pero no puedo conectarme al smtp por el siguiente error

SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Host desconocido. (0)
SMTP Connect() failed.
Mailer Error: SMTP Connect() failed.


les agradesco una respuesta porque estoy desesperado

Código PHP:

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>PHPMailer - SMTP test</title>
</head>
<body>
<?php

//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');

require 
'../Archivos/class.phpmailer.php';

//Create a new PHPMailer instance
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->IsSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug  2;
//Ask for HTML-friendly debug output
$mail->Debugoutput 'html';
//Set the hostname of the mail server
$mail->Host       "mail.gmail.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port       25;
//Whether to use SMTP authentication
$mail->SMTPAuth   true;
//Username to use for SMTP authentication
$mail->Username   "[email protected]";
//Password to use for SMTP authentication
$mail->Password   "waveproject";
//Set who the message is to be sent from
$mail->SetFrom('[email protected]''Ezzio Ltda');
//Set an alternative reply-to address
$mail->AddReplyTo('[email protected]','First Last');
//Set who the message is to be sent to
$mail->AddAddress('[email protected]''John Doe');
//Set the subject line
$mail->Subject 'PHPMailer SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded, convert HTML into a basic plain-text alternative body
$mail->Body    'vamos si se puede Colombia';
//Replace the plain text body with one created manually
$mail->AltBody 'ddd';



//Send the message, check for errors
if(!$mail->Send()) {
  echo 
"Mailer Error: " $mail->ErrorInfo;
} else {
  echo 
"Message sent!";
}
?>
</body>
</html>
  #2 (permalink)  
Antiguo 09/07/2013, 12:08
webankenovi
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: Error Con php mail

el error es claro fallo conexion con el servidor host desconocido

$mail->Host = "smtp.gmail.com";

podria ser ese tu error ?

te dejo un link

http://es.wikicode.org/index.php/Con...iler_con_Gmail
  #3 (permalink)  
Antiguo 09/07/2013, 21:20
 
Fecha de Ingreso: junio-2013
Ubicación: En cualquier parte de mi casa
Mensajes: 139
Antigüedad: 10 años, 11 meses
Puntos: 14
Respuesta: Error Con php mail

un tip! el envio de correos electronicos no funciona desde localhost ok? asi que para probarlo y verificar que lleguen, debes subir tu codigo un web hosting
  #4 (permalink)  
Antiguo 10/07/2013, 08:38
 
Fecha de Ingreso: marzo-2013
Mensajes: 52
Antigüedad: 11 años, 1 mes
Puntos: 0
Respuesta: Error Con php mail

Cita:
Iniciado por edward1994 Ver Mensaje
un tip! el envio de correos electronicos no funciona desde localhost ok? asi que para probarlo y verificar que lleguen, debes subir tu codigo un web hosting
Si muchas gracias lo que pasa es que en el web hosting tambien estoy teniendo el mismo problema :(
  #5 (permalink)  
Antiguo 11/07/2013, 11:07
 
Fecha de Ingreso: junio-2013
Ubicación: En cualquier parte de mi casa
Mensajes: 139
Antigüedad: 10 años, 11 meses
Puntos: 14
Respuesta: Error Con php mail

Una pregunta!...Porque no usas la funcion mail() normal? o sea sin la clase PHPmailer? porque si es para solo mostrar datos e imagenes yo la uso y me va de maravilla! eso si el formato del mail debe de ser con un HTML muy limpio! o sea sin errores! y con contenido variante, para que asi llegue a la bandeja de entrada sin problemas y no llegue como spam
  #6 (permalink)  
Antiguo 11/07/2013, 12:38
 
Fecha de Ingreso: febrero-2009
Ubicación: mexico
Mensajes: 148
Antigüedad: 15 años, 2 meses
Puntos: 1
Respuesta: Error Con php mail

El puerto es 465 no 25

Etiquetas: html, mail
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:14.