Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: mail() doesn't works but sendmail works ?¡!¿

    Hi to you all.
    I have my server (red hat 8 fully updated) with the xampp project (apache 2.0.47, latest php, latest mysql, and so on...) installed.

    I'm trying to use the php mail() function to send feedback from my site but i can't get it working. First of all I've disabled safe_mode (not a good idea) to avoid problems.

    I've tested my code on other servers using xampp (on a windowsxp) and works OK (but the config is different from the redhat8 server), so it's not a coding problem.

    Mail() function returns 1 if the sendinf was ok and I allways get a 1, so I suppose the sending was OK but.. NO. I never receive that e-mail. As mail() uses sendmail I tried to use sendmail from the command line and.. works perfect so ¿where is my problem? ¿permission matters? APache runs as user www

    Some data:
    [root@odyssea sbin]# pwd
    [root@odyssea sbin]# ll send*
    lrwxrwxrwx 1 root root 21 Jul 18 16:43 sendmail -> /etc/alternatives/mta
    -rwxr-sr-x 1 root smmsp 3750315 Aug 26 13:58 sendmail.sendmail

    [root@odyssea sbin]# ll /etc/alternatives/mta
    lrwxrwxrwx 1 root root 27 Sep 1 09:14 /etc/alternatives/mta -> /usr/sbin/sendmail.sendmail

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

    ; For Win32 only. So in unix doesn't matters
    sendmail_from = me@localhost

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

    Please, I need you help...

    Thanks in advance

  2. #2
    Join Date
    Sep 2003
    Hmm. Can you post an example of your mail script? I know on the RH server our host uses, I have to pass an additional argument to mail(), which basically fools sendmail in sending it from a specific user. The fifth argument which is "-f". So our mail script makeup is like this:
    PHP Code:
    $sub "Testing PHP";
    $msg "Hey, read the subject line!";
    $headers "From: Good Guy <>\n";
    $extra "-f [email][/email]";

    if (!
    $mail mail($to$sub$msg$headers$extra))
    "Could not send email.");

    "Mail sent.";
    I also notice you don't have your sendmail path specifically configured in the php.ini file; now, this isn't strictly necessary, but you should check your phpinfo() to verify where PHP thinks sendmail is.
    Just a thought.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts