Foros del Web » Programando para Internet » PHP »

Problema con funcion mail y XAMPP

Estas en el tema de Problema con funcion mail y XAMPP en el foro de PHP en Foros del Web. Hola a todos tengo un problema con la funcion mail() de php y xampp; el problema es que no logro hacer que envie correos desde ...
  #1 (permalink)  
Antiguo 14/04/2015, 21:10
 
Fecha de Ingreso: febrero-2014
Mensajes: 107
Antigüedad: 10 años, 1 mes
Puntos: 0
Problema con funcion mail y XAMPP

Hola a todos tengo un problema con la funcion mail() de php y xampp; el problema es que no logro hacer que envie correos desde php y ya no se que hacer he probado con las configuraciones que he visto en diferentes foros y nada que doy con el problema.

este es el codigo php
Código PHP:
Ver original
  1. <?php
  2. $destino="[email protected]";
  3. $asunto="correo de prueba";
  4. $mensaje="Este es un correo de prueba HOLA MUNDO";
  5. $encabezados="From: Artemisa IX<[email protected]>";
  6.  
  7. if(mail($destino, $asunto, $mensaje, $encabezados)){
  8.     echo "Mail enviado correctamente";
  9. }else {
  10.     echo "Error al enviar el mail";
  11.     }
  12. ?>

Este es el php.ini

Código Apache:
Ver original
  1. [mail function]
  2. ; XAMPP: Comment out this if you want to work with an SMTP Server like Mercury
  3. SMTP = smtp.gmail.com
  4. smtp_port = 587
  5.  
  6. ; For Win32 only.
  7. ; http://php.net/sendmail-from
  8. sendmail_from = [email protected]
  9.  
  10. ; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesC:\xampp) fakemail and mailtodisk do not work correctly.
  11. ; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.  
  12. ; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
  13. sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
  14.  
  15. ; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the C:\xampp\mailoutput folder
  16. ;sendmail_path="C:\xampp\mailtodisk\mailtodisk.exe"
  17.  
  18. ; Force the addition of the specified parameters to be passed as extra parameters
  19. ; to the sendmail binary. These parameters will always replace the value of
  20. ; the 5th parameter to mail(), even in safe mode.
  21. ;mail.force_extra_parameters =
  22.  
  23. ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
  24. mail.add_x_header=Off
  25.  
  26. ; Log all mail() calls including the full path of the script, line #, to address and headers
  27. ;mail.log = "C:\xampp\php\logs\php_mail.log"

Este es el sendmail.ini

Código Apache:
Ver original
  1. ; configuration for fake sendmail
  2.  
  3. ; if this file doesn't exist, sendmail.exe will look for the settings in
  4. ; the registry, under HKLM\Software\Sendmail
  5.  
  6. [sendmail]
  7.  
  8. ; you must change mail.mydomain.com to your smtp server,
  9. ; or to IIS's "pickup" directory.  (generally C:\Inetpub\mailroot\Pickup)
  10. ; emails delivered via IIS's pickup directory cause sendmail to
  11. ; run quicker, but you won't get error messages back to the calling
  12. ; application.
  13.  
  14. smtp_server=smtp.gmail.com
  15.  
  16. ; smtp port (normally 25)
  17.  
  18. smtp_port=587
  19.  
  20. ; SMTPS (SSL) support
  21. ;   auto = use SSL for port 465, otherwise try to use TLS
  22. ;   ssl  = alway use SSL
  23. ;   tls  = always use TLS
  24. ;   none = never try to use SSL
  25.  
  26. smtp_ssl=auto
  27.  
  28. ; the default domain for this server will be read from the registry
  29. ; this will be appended to email addresses when one isn't provided
  30. ; if you want to override the value in the registry, uncomment and modify
  31.  
  32. ;default_domain=mydomain.com
  33.  
  34. ; log smtp errors to error.log (defaults to same directory as sendmail.exe)
  35. ; uncomment to enable logging
  36.  
  37. error_logfile=error.log
  38.  
  39. ; create debug log as debug.log (defaults to same directory as sendmail.exe)
  40. ; uncomment to enable debugging
  41.  
  42. ;debug_logfile=debug.log
  43.  
  44. ; if your smtp server requires authentication, modify the following two lines
  45.  
  46. auth_password=mipass
  47.  
  48. ; if your smtp server uses pop3 before smtp authentication, modify the
  49. ; following three lines.  do not enable unless it is required.
  50.  
  51. pop3_server=
  52. pop3_username=
  53. pop3_password=
  54.  
  55. ; force the sender to always be the following email address
  56. ; this will only affect the "MAIL FROM" command, it won't modify
  57. ; the "From: " header of the message content
  58.  
  59.  
  60. ; force the sender to always be the following email address
  61. ; this will only affect the "RCTP TO" command, it won't modify
  62. ; the "To: " header of the message content
  63.  
  64. force_recipient=
  65.  
  66. ; sendmail will use your hostname and your default_domain in the ehlo/helo
  67. ; smtp greeting.  you can manually set the ehlo/helo name if required
  68.  
  69. hostname=

Ayudenme por favor no se que mas hacer...
  #2 (permalink)  
Antiguo 15/04/2015, 09:24
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 9 meses
Puntos: 379
Respuesta: Problema con funcion mail y XAMPP

Me temo que esta pregunta la tienes que hacer en el sitio oficial del proyecto, debes de tomar en consideración que no todos utilizan xamp, wamp, easyphp, etc.
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.
  #3 (permalink)  
Antiguo 15/04/2015, 09:44
Avatar de lauser
Moderator Unix/Linux
 
Fecha de Ingreso: julio-2013
Ubicación: Odessa (Ukrania)
Mensajes: 3.278
Antigüedad: 10 años, 8 meses
Puntos: 401
Respuesta: Problema con funcion mail y XAMPP

No te lanza ningun error?. Supongo que recuerdas que el puerto 587 requiere autentificación.

Prueba el resultado con el 25, a ver que te dice.
__________________
Los usuarios que te responden, lo hacen altruistamente y sin ánimo de lucro con el único fin de ayudarte. Se paciente y agradecido.
-SOLOLINUX-
  #4 (permalink)  
Antiguo 15/04/2015, 10:20
 
Fecha de Ingreso: enero-2007
Mensajes: 285
Antigüedad: 17 años, 3 meses
Puntos: 21
Respuesta: Problema con funcion mail y XAMPP

no se si habra cambiado.. por que hace mucho que uso phpmailer.. pero si estas trabajando en loca.. debes activar un servidor smtp... no se si ahora el xampp ya trae incluido uno...
  #5 (permalink)  
Antiguo 16/04/2015, 18:36
 
Fecha de Ingreso: febrero-2014
Mensajes: 107
Antigüedad: 10 años, 1 mes
Puntos: 0
Respuesta: Problema con funcion mail y XAMPP

Cita:
Iniciado por lauser Ver Mensaje
No te lanza ningun error?. Supongo que recuerdas que el puerto 587 requiere autentificación.

Prueba el resultado con el 25, a ver que te dice.
No me da ningun error; y no entiendo la parte ¿como asi que requiere autenticacion el puerto 587? La verdad hasta hace poco estoy usando xampp y poco se yo de configuracion de correos y redes.
  #6 (permalink)  
Antiguo 16/04/2015, 21:40
Avatar de gildus  
Fecha de Ingreso: agosto-2003
Mensajes: 1.495
Antigüedad: 20 años, 8 meses
Puntos: 105
Respuesta: Problema con funcion mail y XAMPP

Holas,

El error no siempre las podras ver en la misma web, mas si y mas seguro la podras ver en los logs de tu servidor web en este caso de tu apache.

Otra forma es que al inicio de tu archivo coloques lo siguiente:
Código PHP:
Ver original
  1. ini_set("display_errors", 1);

para poder ver todos los errores.



Ya nos comentas.

Saludos,
__________________
.: Gildus :.
  #7 (permalink)  
Antiguo 17/04/2015, 03:00
Avatar de lauser
Moderator Unix/Linux
 
Fecha de Ingreso: julio-2013
Ubicación: Odessa (Ukrania)
Mensajes: 3.278
Antigüedad: 10 años, 8 meses
Puntos: 401
Respuesta: Problema con funcion mail y XAMPP

Cita:
Iniciado por shikamarucb Ver Mensaje
No me da ningun error; y no entiendo la parte ¿como asi que requiere autenticacion el puerto 587? La verdad hasta hace poco estoy usando xampp y poco se yo de configuracion de correos y redes.
Pues lo que pone... que requiere autentificación. Prueba a cambiar al puerto 25.
__________________
Los usuarios que te responden, lo hacen altruistamente y sin ánimo de lucro con el único fin de ayudarte. Se paciente y agradecido.
-SOLOLINUX-
  #8 (permalink)  
Antiguo 17/04/2015, 20:27
 
Fecha de Ingreso: febrero-2014
Mensajes: 107
Antigüedad: 10 años, 1 mes
Puntos: 0
Respuesta: Problema con funcion mail y XAMPP

Hola a todos, pues nada que doy con el chistesito, aca estan los logs, yo los lei y vi varios foros, no se si tenga que ver con el windows 8 . Los dejo en un link de mega, pesan 6kb.

https://mega.nz/#!0A4nUKrB!Tu3H8ZfRY...9nn4jhffEkJrOU
  #9 (permalink)  
Antiguo 17/04/2015, 20:42
 
Fecha de Ingreso: abril-2015
Mensajes: 11
Antigüedad: 9 años
Puntos: 0
Respuesta: Problema con funcion mail y XAMPP

Alguien te consultó sobre si estas trabajando en localhost. da la impresión que no tenes un servicio iniciado para que haga algo como mail(). algunos errores similares aparecian cuando usaban php como cgi en los servicios baratos de hosting. si vas a usar un local host, antes que xampp te recomiendo pedorros como php triad o mejor un appserv. el último es un lujo
saludos

Etiquetas: lanzar, mail, mensaje, xampp
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 15:50.