HELP: mail() not working!

Discussion in 'Programming/Scripts' started by tapsemi, Apr 4, 2008.

  1. tapsemi

    tapsemi New Member

    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
    .
    -----------------------

    What do you think is the problem or how can I fix it? Any clues/links is highly appreciated. I am totally frustrated now.
     
    Last edited by a moderator: Apr 4, 2008
  2. Ben

    Ben Active Member Moderator

    so if mail() is not working, the return value of mail() should be false.

    To check why mails are not leaving your server, please check the mail logs in /var/log to see what happens while you try to send an email via mail().
     
  3. tapsemi

    tapsemi New Member

    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=<[email protected]>
    Apr 4 07:04:08 75-126-255-51 postfix/qmgr[13998]: CC931CF006B: from=<[email protected]>, size=641, nrcpt=1 (queue active)
    Apr 4 07:04:08 75-126-255-51 postfix/local[19817]: CC931CF006B: to=<[email protected]>, 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=<[email protected]>
    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=<[email protected]>, orig_to=<[email protected]>, 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 [email protected] address. It seems to me from this log that the email id [email protected] doesn't exist, however it is not true. I can send email to this address from any normal mail service.
     
    Last edited: Apr 4, 2008
  4. falko

    falko Super Moderator Howtoforge Staff

Share This Page