Ver Mensaje Individual
  #3 (permalink)  
Antiguo 17/04/2015, 08:51
rehtse
 
Fecha de Ingreso: febrero-2008
Ubicación: Alcañiz (Teruel)
Mensajes: 17
Antigüedad: 16 años, 2 meses
Puntos: 0
Respuesta: Problema con PHPMailer y emails con dominio propio

Ok :)


Código PHP:
Ver original
  1. <?php
  2.  
  3. require('PHPMailer_5.2.2/class.phpmailer.php');
  4. class.phpmailer.php if not already loaded
  5.  
  6. $mail = new PHPMailer();
  7.  
  8. $body = "Detalles del formulario de contacto: <br>";
  9. $body .= "Nombre: " . $_POST['your-name'] . "<br>";
  10. $body .= "Apellido: " . $_POST['Apellidos'] . "<br>";
  11. $body .= "E-mail: " . $_POST['your-email'] . "<br>";
  12. $body .= "Teléfono: " . $_POST['telefono'] . "<br>";
  13. $body .= "Skype: " . $_POST['text-360'] . "<br>";
  14. $body .= "Edad: " . $_POST['number-837'] . "<br>";
  15. $body .= "Asunto: ". $_POST['your-subject']. "<br>";
  16. $body .= "Motivo Consulta: " . $_POST['your-message'] . "<br><br>";
  17.  
  18.  
  19. $mail->IsSMTP(); // telling the class to use SMTP
  20.  
  21. $mail->SMTPAuth = true; // enable SMTP authentication
  22. $mail->Host = "mihost.com"; // sets the SMTP server
  23. $mail->Port = 25; // set the SMTP port for the GMAIL server
  24. $mail->Username = "midireccionemail"; // SMTP account username
  25. $mail->Password = "password"; // SMTP account password
  26.  
  27. $mail->Subject = "Consulta online";
  28.  
  29. $mail->MsgHTML($body);
  30.  
  31. $numero=$_POST['checkbox-906'];
  32. $count = count($numero);
  33. for ($i = 0; $i < $count; $i++) {
  34. if ($numero[$i]==1){
  35. $mail->AddAddress("[email protected]", "direccion1");
  36. }
  37. if ($numero[$i]==2){
  38. $mail->AddAddress("[email protected]", "direccion2");
  39. }
  40. if ($numero[$i]==3){
  41. $mail->AddAddress("[email protected]", "direccion3");
  42. }
  43. }
  44.  
  45.  
  46. if(!$mail->Send()) {
  47. echo "Mailer Error: " . $mail->ErrorInfo;
  48. } else {
  49. header ("location:http://.../gracias-por-tu-mensaje/" ) ;
  50. die();
  51.  
  52.  
  53. }
  54.  
  55. ?>