Ver Mensaje Individual
  #9 (permalink)  
Antiguo 10/02/2012, 16:06
Avatar de DooBie
DooBie
 
Fecha de Ingreso: septiembre-2004
Mensajes: 1.101
Antigüedad: 19 años, 7 meses
Puntos: 71
Respuesta: Como validar en PHPMailer

Código PHP:
Ver original
  1. if($tatus == "OK"){
  2. $body1="<html>
  3. <head>
  4. <p><font face=Tahoma, Helvetica, sans-serif size=2 color=#333333>
  5. <strong>Formulari de Contacte Web:</strong></font><br>
  6. <br><hr width=450px align=left><br>
  7. <font face=Tahoma, Helvetica, sans-serif size=2>
  8.  
  9. <title>Formulario de Contacto Web</title>
  10. </head>
  11. <body>
  12. <strong>Nombre:</strong> $name.<br>
  13. <strong>Tel&eacute;fono:</strong> $phone.<br>
  14. <strong>T&iacute;tulo:</strong> $title: $otros2.<br>
  15. <strong>Email:</strong> $email.<br>
  16. <strong>Mensaje:</strong> $message.</font></p>
  17. </body>
  18. </html> ";
  19.  
  20. require_once 'phpmailer/class.phpmailer.php';
  21.  
  22. $mail = new PHPMailer ();
  23. $mail -> SetFrom ("[email protected]","[email protected]");
  24. $mail -> AddAddress ("$email","$name");
  25. $mail -> Subject = "$title: $otros2";
  26. $mail -> IsHTML (true);
  27. $mail -> IsSMTP();
  28. $mail -> Host = 'mail.dominio.com';
  29. $mail -> Port = 2626;
  30. $mail -> SMTPDebug = 2;
  31. $mail -> SMTPAuth = true;
  32. $mail -> Username = '[email protected]';
  33. $mail -> Password = 'password';
  34. $mail -> MsgHTML(file_get_contents('www.dominio.com/archivos/recibido.html'));
  35. if ($mail -> Send())
  36. {
  37. $msg=" Enviado.";
  38. }else{
  39. $msgerror=" Error inesperado.";
  40. }
  41.  
  42. $mail = new PHPMailer ();
  43. $mail -> SetFrom ("[email protected]","[email protected]");
  44. $mail -> AddAddress("$headers4");
  45. $mail -> Subject = "$title: $otros2";
  46. $mail -> IsHTML (true); // pones (true) en caso de usar formato HTML
  47. $mail -> IsSMTP();
  48. $mail -> Host = 'mail.dominio.com';
  49. $mail -> Port = 2626;
  50. $mail -> SMTPAuth = true;
  51. $mail -> Username = '[email protected]';
  52. $mail -> Password = 'password';
  53. $mail -> MsgHTML($body1);
  54. $mail -> Send();
  55. }
  56. }else{
  57. // No ha pasado la validación, aquí haces lo que tu quieras.
  58. }

Algo así (añade la parte de código que falta al principio).