Foros del Web » Programando para Internet » PHP »

phpmailer i SetFrom problemas a la hora de entrar el correo electronico

Estas en el tema de phpmailer i SetFrom problemas a la hora de entrar el correo electronico en el foro de PHP en Foros del Web. me sale el siguiente error You must provide at least one recipient email address. <html> <head> </head> <body> <form action="test_smtp_gmail_advanced.php" method="post" name="contactar" > <div> <label ...
  #1 (permalink)  
Antiguo 03/01/2010, 09:16
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses
Puntos: 1
phpmailer i SetFrom problemas a la hora de entrar el correo electronico

me sale el siguiente error You must provide at least one recipient email address.



<html>
<head>
</head>
<body>
<form action="test_smtp_gmail_advanced.php" method="post" name="contactar" >
<div>
<label for="correo">Correo</label>
<input type="text" id="correo" />
</div>

<div>
<label for="assumpto">Assumpto</label>
<input type="text" id="assumpto" />
</div>

<div>
<textarea id="mensaje" name="mensaje" ></textarea>
<label for="mensaje">Mensaje</label>
</div>

<input type="submit" value="Enviar" />
</form>
</body>
</html>

------------------------------------------------------------------------------------------------------------------

<html>

<head>

<title>PHPMailer - SMTP (Gmail) advanced test</title>

</head>

<body>



<?php

include("class.phpmailer.php");

include("class.smtp.php");



$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch



$mail->IsSMTP(); // telling the class to use SMTP



try {

$mail->Host = "mail.yourdomain.com"; // SMTP server

$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)

$mail->SMTPAuth = true; // enable SMTP authentication

$mail->SMTPSecure = "ssl"; // sets the prefix to the servier

$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server

$mail->Port = 465; // set the SMTP port for the GMAIL server

$mail->Username = "[email protected]"; // GMAIL username

$mail->Password = "********"; // GMAIL password


$mail->SetFrom= ($_POST['correo']);


$mail->Subject = ($_POST['assumpto']);


$mail->MsgHTML = ($_POST['mensaje']);





$mail->Send();

echo "Message Sent OK</p>\n";

} catch (phpmailerException $e) {

echo $e->errorMessage(); //Pretty error messages from PHPMailer

} catch (Exception $e) {

echo $e->getMessage(); //Boring error messages from anything else!

}

?>



</body>

</html>
  #2 (permalink)  
Antiguo 03/01/2010, 09:48
Avatar de DooBie  
Fecha de Ingreso: septiembre-2004
Mensajes: 1.101
Antigüedad: 19 años, 7 meses
Puntos: 71
Respuesta: phpmailer i SetFrom problemas a la hora de entrar el correo electronico

El fallo lo tienes en el formulario, fijate en los campos input, tienes puesto el id, en lugar del name.

Etiquetas: correo, electronico, phpmailer
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 19:41.