Foros del Web » Programando para Internet » PHP »

Enviar correo

Estas en el tema de Enviar correo en el foro de PHP en Foros del Web. Buenas, aqui estoy otra vez con mis preguntas de novato para poco a poco dejar de serlo jejeje. Ahora estoy con un formulario que al ...
  #1 (permalink)  
Antiguo 23/01/2012, 06:15
 
Fecha de Ingreso: diciembre-2010
Mensajes: 41
Antigüedad: 13 años, 4 meses
Puntos: 0
Enviar correo

Buenas,

aqui estoy otra vez con mis preguntas de novato para poco a poco dejar de serlo jejeje.

Ahora estoy con un formulario que al ser rellenado envie los datos al email seleccionado

Código PHP:
<?php  session_start();

///////Configuración/////
$mail_destinatario '[email protected]';
$headers "";
///////Fin configuración//
if (isset ($_POST['enviar'])) {
    
    
$headers .= "From: ".$_POST['email']. "rn";
    
    if ( 
mail ($mail_destinatario$_POST['asunto'], "Nombre y apellidos : ".$_POST['nombre']." Asunto: ".stripcslashes ($_POST['asunto'])."n                          Mensaje :n ".stripcslashes ($_POST['mensaje']), $headers )) 
            echo 
'Su mensaje a sido enviado correctamente. Gracias por contactar con nosostros';
    else echo 
'Error al enviar el formulario. Por favor, inténtelo de nuevo mas tarde.';
     }

 
?>
Código PHP:
  <form id="contactar" action="?" method="post">
                      <
fieldset id="contacto">
                          <
legend>Datos</legend>
                          <
ul>
                              <
li>
                                  <
label for="nombre">Nombre y apellidos:</label>
                                  <
input id="nombre" name="nombre" type="text" value="" />
                              </
li>
                              <
li>
                                  <
label for="email">Tu email:</label>
                                  <
input id="email" name="email" type="text" value="" />
                              </
li>
                              <
li>
                                  <
label for="asunto">Asunto:</label>
                                  <
input id="asunto" name="asunto" type="text" value="" />
                              </
li>
                              <
li class="textarea">
                                         <
label>Comentario:</label>
                                    <
textarea cols="15" rows="8" name="mensaje"></textarea>
                              </
li>
                          </
ul>
                      </
fieldset>
                  <
input type="submit" name="enviar" id="submit" value="Enviar" />
            </
form

al rellenar estos datos, me sale este error:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\webtracking\contactar.php on line 11
Error al enviar el formulario. Por favor, inténtelo de nuevo mas tarde.

hay que instalar algo? modificar algun archivo del xampp?

Saludos y gracias adelantadas
  #2 (permalink)  
Antiguo 23/01/2012, 06:25
 
Fecha de Ingreso: diciembre-2011
Mensajes: 151
Antigüedad: 12 años, 3 meses
Puntos: 1
Respuesta: Enviar correo

xDDDDDDDDDDD

Si lo pruebas en localhost tendras que instalar algun servidor de correo imagino.. Lo mejor sube la web a un servidor gratuito para hacer pruebas...
  #3 (permalink)  
Antiguo 23/01/2012, 07:35
 
Fecha de Ingreso: diciembre-2010
Mensajes: 41
Antigüedad: 13 años, 4 meses
Puntos: 0
Respuesta: Enviar correo

Me he estado informando por internet, y me he bajado el minirelay, lo ejecuto en el escritorio y ya no me da ese error, me sale el echo de que todo ha ido bien:
"Su mensaje ha sido enviado correctamente. Gracias por contactar con nosostros " pero al correo no ha llegado nada

y en el minirelay server pone esto:

Código PHP:
Ver original
  1. 14:28:02 Escuchando en 127.0.0.1 (Puerto 25)
  2. 14:28:17 Comando: MAIL FROM <micorreo@hotmail.es>
  3. 14:28:17 Comando: RCPT TO <micorreo@hotmail.es>
  4. 14:28:17 [1] Resolviendo dominio MX de hotmail.es
  5. 14:28:17 [1] Conectando con mx1.hotmail.com
  6. 14:28:18 [1] Enviando mensaje
  7. 14:28:18 [1] Error DY-001 (SNT0-MC2-F36) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  8. 14:28:18 [1] Conectando con mx1.hotmail.com
  9. 14:28:19 [1] Error DY-001 (SNT0-MC2-F47) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  10. 14:28:19 [1] Conectando con mx1.hotmail.com
  11. 14:28:20 [1] Error DY-001 (SNT0-MC2-F42) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  12. 14:28:20 [1] Conectando con mx2.hotmail.com
  13. 14:28:21 [1] Enviando mensaje
  14. 14:28:21 [1] Error DY-001 (SNT0-MC3-F12) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  15. 14:28:21 [1] Conectando con mx2.hotmail.com
  16. 14:28:22 [1] Error DY-001 (SNT0-MC3-F34) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  17. 14:28:22 [1] Conectando con mx2.hotmail.com
  18. 14:28:23 [1] Error DY-001 (SNT0-MC3-F39) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  19. 14:28:23 [1] Conectando con mx3.hotmail.com
  20. 14:28:24 [1] Enviando mensaje
  21. 14:28:24 [1] Error DY-001 (COL0-MC3-F5) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  22. 14:28:24 [1] Conectando con mx3.hotmail.com
  23. 14:28:25 [1] Error DY-001 (COL0-MC3-F22) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  24. 14:28:25 [1] Conectando con mx3.hotmail.com
  25. 14:28:26 [1] Error DY-001 (COL0-MC3-F14) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  26. 14:28:26 [1] Conectando con mx4.hotmail.com
  27. 14:28:27 [1] Enviando mensaje
  28. 14:28:27 [1] Error DY-001 (BAY0-MC4-F37) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  29. 14:28:27 [1] Conectando con mx4.hotmail.com
  30. 14:28:29 [1] Error DY-001 (BAY0-MC4-F42) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  31. 14:28:29 [1] Conectando con mx4.hotmail.com
  32. 14:28:30 [1] Error DY-001 (BAY0-MC4-F28) Unfortunately, messages from 79.144.103.227 weren't sent. Please contact your Internet service provider. You can tell them that Hotmail does not relay dynamically-assigned IP ranges. You can also refer your provider to http://mail.live.com/mail/troubleshooting.aspx#errors.
  33. 14:28:30 [1] ERROR: Se ha reintentado el envio 3 veces, devolviendo mensaje


El archivo php.ini esta asi:
...
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = [email protected]
...
  #4 (permalink)  
Antiguo 23/01/2012, 09:58
Avatar de jotaincubus  
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 18 años, 11 meses
Puntos: 394
Respuesta: Enviar correo

El log del MINIRELAY es perfectamente claro "HOTMAIL no permite correo electrónico proveniente de servidores con IPs dinámicas.

Lo que podes hacer es o comprar una IP estática que no este en listas de SPAM o utilizar GMAIL que permite relay.
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???
  #5 (permalink)  
Antiguo 23/01/2012, 10:22
 
Fecha de Ingreso: diciembre-2010
Mensajes: 41
Antigüedad: 13 años, 4 meses
Puntos: 0
Respuesta: Enviar correo

Lo he probado con gmail y me sigue sin funcionar...creo que pone que la IP que estoy usando no esta autorizada, aqui os pongo lo del minirelay:

Código PHP:
17:14:33 [1Error 5.7.1 [79.144.103.227The IP you're using to send mail is not authorized to
5.7.1 send email directly to our servers. Please use the SMTP relay at your
5.7.1 service provider instead. Learn more at
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 u2si11169749wiw.1
17:14:33 [1] Conectando con gmail-smtp-in.l.google.com
17:14:34 [1] Error 5.7.1 [79.144.103.227] The IP you'
re using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 ey4si11122673wib.28
17:14:34 [1Conectando con gmail-smtp-in.l.google.com
17
:14:35 [1Error 5.7.1 [79.144.103.227The IP you're using to send mail is not authorized to
5.7.1 send email directly to our servers. Please use the SMTP relay at your
5.7.1 service provider instead. Learn more at
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 hq13si6856059wib.47
17:14:35 [1] Conectando con alt1.gmail-smtp-in.l.google.com
17:14:35 [1] Enviando mensaje
17:14:36 [1] Error 5.7.1 [79.144.103.227] The IP you'
re using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 eb2si6682996bkb.116
17:14:36 [1Conectando con alt1.gmail-smtp-in.l.google.com
17
:14:37 [1Error 5.7.1 [79.144.103.227The IP you're using to send mail is not authorized to
5.7.1 send email directly to our servers. Please use the SMTP relay at your
5.7.1 service provider instead. Learn more at
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 c10si6692095bke.77
17:14:37 [1] Conectando con alt1.gmail-smtp-in.l.google.com
17:14:38 [1] Error 5.7.1 [79.144.103.227] The IP you'
re using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 c10si6692119bke.77
17:14:38 [1Conectando con alt2.gmail-smtp-in.l.google.com
17
:14:39 [1Enviando mensaje
17
:14:40 [1Error 5.7.1 [79.144.103.227The IP you're using to send mail is not authorized to
5.7.1 send email directly to our servers. Please use the SMTP relay at your
5.7.1 service provider instead. Learn more at
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 ih7si5286171lab.23
17:14:40 [1] Conectando con alt2.gmail-smtp-in.l.google.com
17:14:41 [1] Error 5.7.1 [79.144.103.227] The IP you'
re using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 oh10si473002lab.16
17:14:41 [1Conectando con alt2.gmail-smtp-in.l.google.com
17
:14:43 [1Error 5.7.1 [79.144.103.227The IP you're using to send mail is not authorized to
5.7.1 send email directly to our servers. Please use the SMTP relay at your
5.7.1 service provider instead. Learn more at
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 io8si1696309lab.43
17:14:43 [1] Conectando con alt3.gmail-smtp-in.l.google.com
17:14:44 [1] Enviando mensaje
17:14:46 [1] Error 5.7.1 [79.144.103.227] The IP you'
re using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 c1si16935302pbl.115
17:14:46 [1Conectando con alt3.gmail-smtp-in.l.google.com
17
:14:48 [1Error 5.7.1 [79.144.103.227The IP you're using to send mail is not authorized to
5.7.1 send email directly to our servers. Please use the SMTP relay at your
5.7.1 service provider instead. Learn more at
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 z7si16890297pbm.236
17:14:48 [1] Conectando con alt3.gmail-smtp-in.l.google.com
17:14:52 [1] Error 5.7.1 [79.144.103.227] The IP you'
re using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 c7si16943621pbv.91
17:14:52 [1Conectando con alt4.gmail-smtp-in.l.google.com
17
:14:52 [1Enviando mensaje
17
:14:54 [1Error 5.7.1 [79.144.103.227The IP you're using to send mail is not authorized to
5.7.1 send email directly to our servers. Please use the SMTP relay at your
5.7.1 service provider instead. Learn more at
5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 oy9si3156495obb.152
17:14:54 [1] Conectando con alt4.gmail-smtp-in.l.google.com
17:14:56 [1] Error 5.7.1 [79.144.103.227] The IP you'
re using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 qk9si3128447obc.93
17:14:56 [1Conectando con alt4.gmail-smtp-in.l.google.com
17
:14:58 [1Error 5.7.1 [79.144.103.227The IP youre using to send mail is not authorized to
5.7.1 send email directly to our servers
Please use the SMTP relay at your
5.7.1 service provider instead
Learn more at
5.7.1 http
://support.google.com/mail/bin/answer.py?answer=10336 h5si3299903obx.83
17:14:58 [1ERRORSe ha reintentado el envio 3 vecesdevolviendo mensaje 
  #6 (permalink)  
Antiguo 23/01/2012, 14:50
 
Fecha de Ingreso: diciembre-2010
Mensajes: 41
Antigüedad: 13 años, 4 meses
Puntos: 0
Respuesta: Enviar correo

Nadie lo sabe? Soluciones alternativas?
  #7 (permalink)  
Antiguo 23/01/2012, 17:11
 
Fecha de Ingreso: diciembre-2011
Mensajes: 151
Antigüedad: 12 años, 3 meses
Puntos: 1
Respuesta: Enviar correo

Subir la pagina a un servidor gratuito no te sirve? Si algun dia tendras que subirla...
  #8 (permalink)  
Antiguo 24/01/2012, 04:46
 
Fecha de Ingreso: diciembre-2010
Mensajes: 41
Antigüedad: 13 años, 4 meses
Puntos: 0
Respuesta: Enviar correo

Cual es el mejor servidor gratuito que soporte PHP y MySQL? Te mete mucha propaganda?

Etiquetas: correo, formulario
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 20:05.