Foros del Web » Administración de Sistemas » Unix / Linux »

Problema con envio de mail via PHP mail()

Estas en el tema de Problema con envio de mail via PHP mail() en el foro de Unix / Linux en Foros del Web. Saludos. Estoy intentando colocar un server de mensajes MTA en mi ubuntu 8.04. He instalado el postfix, pero he tenido problemas para enivar un mensaje ...
  #1 (permalink)  
Antiguo 07/08/2008, 16:15
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Problema con envio de mail via PHP mail()

Saludos.
Estoy intentando colocar un server de mensajes MTA en mi ubuntu 8.04. He instalado el postfix, pero he tenido problemas para enivar un mensaje por un script en PHP utilizando la funcion mail().
Nota: a pesar que he googleado y he visto los mensajes que tratan de postfix en el foro no he conseguido hacer que funcione.

El servidor es local.
Mi /etc/postfix/main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = n0dix
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = n0dix, localhost.localdomain, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all


Mi /etc/php5/apache2/php.ini (lo que se refiere a SMTP)es:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = [email protected]

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = sendmail -t -i


El /var/log/mail.log es (simplificado):
Aug 7 16:52:46 n0dix postfix/qmgr[5772]: 50DCF1E4421: from=<www-data@n0dix>, size=410, nrcpt=1 (queue active)
Aug 7 16:52:46 n0dix postfix/qmgr[5772]: 615311E4401: from=<www-data@n0dix>, size=410, nrcpt=1 (queue active)
Aug 7 16:55:17 n0dix postfix/smtp[17925]: connect to alt1.gmail-smtp-in.l.google.com[72.14.205.114]:25: Connection timed out
Aug 7 16:55:17 n0dix postfix/smtp[17927]: connect to alt2.gmail-smtp-in.l.google.com[72.14.221.27]:25: Connection timed out
Aug 7 16:55:17 n0dix postfix/smtp[17928]: 192D31E43EB: to=<[email protected]>, relay=none, delay=47728, delays=47577/0.02/150/0, dsn=4.4.1, status=deferred (connect to alt1.gmail-smtp-in.l.google.com[72.14.205.27]:25: Connection timed out)
Aug 7 16:55:17 n0dix postfix/error[18316]: 29D801E43E7: to=<[email protected]>, relay=none, delay=43017, delays=42867/151/0/0.12, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to alt2.gmail-smtp-in.l.google.com[72.14.221.27]:25: Connection timed out)

Mi script de PHP es:
$send = mail("[email protected]","Hola soy yo","Es para ver si funciona","From: [email protected]");

Alguna sugerencia?
  #2 (permalink)  
Antiguo 07/08/2008, 18:12
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Problema con envio de mail via PHP mail()

Tema trasladado a Linux.
  #3 (permalink)  
Antiguo 08/08/2008, 06:49
Avatar de AleSanchez
Colaborador
 
Fecha de Ingreso: septiembre-2004
Ubicación: Buenos Aires, Argentina
Mensajes: 3.692
Antigüedad: 19 años, 7 meses
Puntos: 47
Respuesta: Problema con envio de mail via PHP mail()

Estas haciendo que tu server envíe directamente los mails y tenés cerrado el puerto 25 saliente.
Tenes que configurar la opcion relayhost con el smtp de tu proveedor de internet.
__________________
¡Volviendo a la programación!
  #4 (permalink)  
Antiguo 09/08/2008, 01:31
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Problema con envio de mail via PHP mail()

Gracias por la respuesta.
Pero en vista que no podia instalar el servidor con el postfix, intente con el qmail.

Instale qmail e hice el cambio en el php.ini para que utilizace el qmail-inject. Cuando intento enviar un mensaje me sale de error:
Sorry,_I_wasn't_able_to_establish_an_SMTP_connecti on._(#4.4.1)/

He hecho un telnet localhost 25 , y no he tenido problemas.

Tal vez el problema que tengo es el mismo que para postfix. He buscado configurar un relayhost para qmail. He configurado el /etc/tcp.smtp :
127.:allow,RELAYCLIENT="".

Y mi /etc/host/ es:
127.0.0.1 localhost
127.0.1.1 n0dix

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


Mi "/var/qmail/bin/qmail-showctl" es:
doublebounceto: (Default.) 2B recipient user: postmaster.

envnoathost: (Default.) Presumed domain name is n0dix.local.

helohost: (Default.) SMTP client HELO host name is n0dix.local.

idhost: (Default.) Message-ID host name is n0dix.local.

localiphost: (Default.) Local IP address becomes n0dix.local.

locals:
Messages for n0dix.local are delivered locally.

me: My name is n0dix.local.

percenthack: (Default.) The percent hack is not allowed.

plusdomain: Plus domain name is n0dix.local.

qmqpservers: (Default.) No QMQP servers.

queuelifetime: (Default.) Message lifetime in the queue is 604800 seconds.

rcpthosts:
SMTP clients may send messages to recipients at n0dix.local.

morercpthosts: (Default.) No effect.

morercpthosts.cdb: (Default.) No effect.

smtpgreeting: (Default.) SMTP greeting: 220 n0dix.local.

smtproutes: (Default.) No artificial SMTP routes.

timeoutconnect: (Default.) SMTP client connection timeout is 60 seconds.

timeoutremote: (Default.) SMTP client data timeout is 1200 seconds.

timeoutsmtpd: (Default.) SMTP server data timeout is 1200 seconds.

virtualdomains: (Default.) No virtual domains.

concurrencyincoming: I have no idea what this file does.

qmail: I have no idea what this file does.

defaultdelivery: I have no idea what this file does.


Espero que esto ayude.

Nota: no se si esta permitdo discutir de otro asunto en el tema creado. Si es asi lo siento.

Última edición por n0dix99; 09/08/2008 a las 01:38
  #5 (permalink)  
Antiguo 09/08/2008, 11:14
Avatar de AleSanchez
Colaborador
 
Fecha de Ingreso: septiembre-2004
Ubicación: Buenos Aires, Argentina
Mensajes: 3.692
Antigüedad: 19 años, 7 meses
Puntos: 47
Respuesta: Problema con envio de mail via PHP mail()

Buen, de Qmail no se nada. Saludos.
__________________
¡Volviendo a la programación!
  #6 (permalink)  
Antiguo 09/08/2008, 11:23
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Problema con envio de mail via PHP mail()

Si tuviese que crear ese relayhost en postfix como seria mas o menos???
  #7 (permalink)  
Antiguo 09/08/2008, 14:49
 
Fecha de Ingreso: agosto-2008
Mensajes: 9
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Problema con envio de mail via PHP mail()

La forma de solucionar el problema que tenia fue agregar en
/var/qmail/control/smtproutes del proveedor de internet.
  #8 (permalink)  
Antiguo 26/11/2008, 08:20
 
Fecha de Ingreso: marzo-2008
Ubicación: Chile
Mensajes: 14
Antigüedad: 16 años, 2 meses
Puntos: 0
Respuesta: Problema con envio de mail via PHP mail()

Cita:
Iniciado por n0dix99 Ver Mensaje
La forma de solucionar el problema que tenia fue agregar en
/var/qmail/control/smtproutes del proveedor de internet.
Disculpa mi ignorancia, tengo un problema casi identico podrias dar el ejemplo como lo agregaste por favor.
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 18:37.