mail() fails - php4, sendmail, suse

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike@shallop.com

    mail() fails - php4, sendmail, suse

    I've spent a couple of days on this and I'm to the "bang-my-head
    'gainst the monitor and babble in tongues" mode.

    First - SuSE Pro 9.3, Linux 2.6.11.4-21.7, Apache 2.0.53, PHP 4.3.10

    I have sendmail running on the local server - mail from unix (1) mail
    and mutt work locally on the server. This is, specifically, sending
    mail to a localhost user or another user off on the net somewhere
    works fine.

    When I try either simple, or complex, mail() functionality via PHP, it
    silently fails. And, by silently, I mean that there are no error
    messages in the PHP log (logging of all messages is enabled), sendmail
    log, or /var/log/messages or /var/log/warnings. The mail() returns a
    FALSE indicating that the php->sendmail handoff never occurs. I've
    even tried forcing the return address but that's not working either.
    Stable applications, like OSCommerce for example, also fail under this
    configuration.

    /etc/php.ini is correctly configured and the sendmail_path is defined
    correctly. As a matter of fact, the results are the same whether or
    not sendmail_path is implicitly or explicitly configured. Currently:

    ; For Unix only. You may supply arguments as well (default: "sendmail
    -t -i").
    sendmail_path = '/usr/sbin/sendmail -t -i'
    ....
    safe_mode = Off

    I've tried mutltiple sendmail configurations but this was a waste of
    time for the reason that sendmail is never seeing the email handoff
    from php.

    This was working under my 9.2 install - but w/the upgrade to 9.3, it is
    failing again. I say "again" because when I upgraded to 9.2 from 9.1,
    it failed and my mature-memory(tm) has prevented me from recalling what
    exactly I did to address the issue.

    Google'ing has turned up a lot of ideas, but no solution and it would
    appear that I'm not the only one suffering with this problem.

    Thanks in advance...I need this functionality in OSCommerce, but I
    figure that, whatever is causing the little dink scripts to fail, is
    also causing the big-bore scripts to fail. Figure out what's causing
    the little guy to barf on his shoes and I should have the solution,
    right?

    --Mike

    example (failing) code using mail():
    $msg = "whatever\n ";

    $msg .= "Sender's Name:
    $sender\n";
    $msg .= "Sender eMail:
    $email\n";
    $msg .= "Message:
    $message\n\n";

    $to = "mike@shallop.c om";
    $subject = "shallop.co m
    feedback email";
    $mailheaders = "From:
    Shallop.com Website\n";
    $mailheaders .= "Reply-To:
    $email\n\n";
    $ret =
    mail($to,$subje ct,$msg,$mailhe aders);
    echo "mail() returned: " .
    ($ret? "TRUE" : "FALSE");
    --> always returns FALSE
    --> in debugging, I successfully return (display) all variables used in
    mail():

    mail() returned: FALSE
    To: mike@shallop.co m
    Subject: shallop.com feedback email
    Msg: eMail Successfully Sent - Thank you! Sender's Name: mike Sender
    eMail: foo@bar.com Message: test for displaying form vars.
    Headers: From: Shallop.com Website Reply-To: foo@bar.com

  • Colin McKinnon

    #2
    Re: mail() fails - php4, sendmail, suse

    mike@shallop.co m wrote:
    [color=blue]
    > I've spent a couple of days on this and I'm to the "bang-my-head
    > 'gainst the monitor and babble in tongues" mode.
    >
    > First - SuSE Pro 9.3, Linux 2.6.11.4-21.7, Apache 2.0.53, PHP 4.3.10
    >
    > I have sendmail running on the local server - mail from unix (1) mail
    > and mutt work locally on the server. This is, specifically, sending
    > mail to a localhost user or another user off on the net somewhere
    > works fine.
    >[/color]

    Things to check:

    1) is your webserver running chroot? If so, then it maybe the sendmail
    executable is not in the jail environment. Or maybe wwwrun does not have
    execute permission for it.

    2) IIRC on *nix box the system does not do a port connection however it
    might be worth making sure you've not got any authentication/TLS running.
    See http://www.zone-h.com/download/file=2563/ for how to debug/test the
    protocol.

    HTH

    C.

    Comment

    • mike@shallop.com

      #3
      Re: mail() fails - php4, sendmail, suse

      FOUND IT!!!

      I finally found a mention of the error in the
      /var/log/apache2/error_log file -

      when you configure php.ini with the default setting for sendmail:

      sendmail_path =

      Then, you will see the following error in the logfile:

      sh: /usr/sbin: is a directory

      Even through php.ini self-documents this directive as the default, it
      still was failing. Changing the directive to (as seen in a previous
      post solution):

      sendmail_path = '/usr/sbin/sendmail -i -t' (note: single quotes)

      Failed with the error message of:

      sh: /usr/sbin/sendmail -i -t: No such file or directory

      Changing the directive to:

      sendmail_path = "/usr/sbin/sendmail -i -t" (note: double quotes)

      Made everything work nicely. Remember to stop and restart the server
      after making changes to php.ini.

      HTH someone....

      --Mike

      Comment

      Working...