31/01/2010, 11:38
|
| | Fecha de Ingreso: febrero-2009
Mensajes: 443
Antigüedad: 15 años, 2 meses Puntos: 1 | |
Respuesta: validar phpmailer con php es un objeto como podria trabajar con el objeto Código 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 = "localhost"; // 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->AddReplyTo('[email protected]', 'First Last'); $mail->AddAddress(strtolower($_POST['correo']),strtolower($_POST['nombre']) ); $mail->SetFrom('[email protected]', 'negocio'); //$mail->AddReplyTo('[email protected]', 'First Last');//remitent $mail->Subject=("negocio ".strtolower($_POST['asunto'])); $mail->MsgHTML(strtolower($_POST['mensaje'])); $mail->Send(); echo "<span class='correcto'><h2>Mensaje enviadao correctamente</h2></span>\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>
Última edición por albertrc; 31/01/2010 a las 12:10 |