PDA

View Full Version : PHP Gurus HELP: mail() not working.


tapsemi
5th April 2008, 07:35
My PHP mail() function is now working!
System Info: Running PHP on webserver running Apache, Postfix(for SMTP) and running on CentOS linux. SMTP is working because I can do telnet localhost 25.

My phpinfo() webpage gives the following information:
-----------------
.
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
SMTP localhost localhost
smtp_port 25 25
.

---------------Additional Information----------------------
I did a tail of the /var/log/maillog. Here are the lines that were generated after I tried to execute the mail script:
(I replaced my real domain name with mydomain.com here)

--------------------------------------

Apr 4 07:04:08 75-126-255-51 postfix/pickup[9377]: CC931CF006B: uid=48 from=<apache>
Apr 4 07:04:08 75-126-255-51 postfix/cleanup[19815]: CC931CF006B: message-id=<20080404070408.CC931CF006B@mydomain.com>
Apr 4 07:04:08 75-126-255-51 postfix/qmgr[13998]: CC931CF006B: from=<apache@mydomain.com>, size=641, nrcpt=1 (queue active)
Apr 4 07:04:08 75-126-255-51 postfix/local[19817]: CC931CF006B: to=<services@mydomain.com>, relay=local, delay=0.04, delays=0.03/0/0/0.01, dsn=5.1.1, status=bounced (unknown user: "services")
Apr 4 07:04:08 75-126-255-51 postfix/cleanup[19815]: D2BC9CF006C: message-id=<20080404070408.D2BC9CF006C@mydomain.com>
Apr 4 07:04:08 75-126-255-51 postfix/qmgr[13998]: D2BC9CF006C: from=<>, size=2306, nrcpt=1 (queue active)
Apr 4 07:04:08 75-126-255-51 postfix/bounce[19818]: CC931CF006B: sender non-delivery notification: D2BC9CF006C
Apr 4 07:04:08 75-126-255-51 postfix/qmgr[13998]: CC931CF006B: removed
Apr 4 07:04:08 75-126-255-51 postfix/local[19817]: D2BC9CF006C: to=<root@mydomain.com>, orig_to=<apache@mydomain.com>, relay=local, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Apr 4 07:04:08 75-126-255-51 postfix/qmgr[13998]: D2BC9CF006C: removed
----------------------------------------

What can we infer from this log file? One more thing, the mail() script is trying to send an email to services@mydomain.com address. It seems to me from this log that the email id services@mydomain.com doesn't exist, however it is not true. I can send email to this address from any normal mail service. :mad:

topdog
5th April 2008, 14:29
it seems from the logs that you have made the domain local and yet this domain is on another server that is why postfix trys to deliver locally but the user does not exist.