Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/01/2010, 09:16
albertrc
 
Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 3 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>