« Previous Next »

Thread: PHP warning: "Could not execute mail delivery program"

Last post 04-15-2009 11:02 PM by mvanemmerik. 5 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (6 items)

Sort Posts:

  • 04-14-2009, 12:35 AM

    • DavidRPotter
    • Not Ranked
    • Joined on 04-14-2009, 3:02 AM
    • Bothell, WA (near Seattle)
    • Posts 10

    PHP warning: "Could not execute mail delivery program"

    I was using PHP 5.2.6 with the ISAPI DLL and recently changed the configuration to use PHP 5.2.9-2 with FastCGI. This is all on IIS 6 on Windows Server 2003 (SBS). I am using a fake sendmail from Byron Jones to allow me to use thePHP mail() function (see my article on it here: http://dpotter.net/Technical/2009/04/using-php-mail-function-with-locked-down-smtp-server/) and everything was peachy. Once I upgraded to FastCGI/PHP5.2.9-2, everything works except for the mail() function. I get the following error message:

    PHP Warning: mail() [function.mail]: Could not execute mail delivery program
    'C:\Inetpub\sendmail\sendmail.exe -t' in C:\Inetpub\wwwroot\email_test.php on line 2

    How do I track this down? How do I determine if this a FastCGI issue or a PHP issue? Note that I can run the sendmail.exe program successfully from the command line. Also note that when I try to convert back to using the ISAPI DLL and the older version of PHP that it no longer works.

    Thanks for your help.
    David

    Technical blog - http://DPotter.net/Technical/
  • 04-14-2009, 12:44 AM In reply to

    Re: PHP warning: "Could not execute mail delivery program"

     Hi David,

     Sounds like a permissions issue. Does IIS have the execute permission on your sendmail program? A good test is to execute the script via the command line while logged in as an administrator.

    ----------------
    Dominic Ryan
    Microsoft IIS MVP
    www.iis-aid.com
    My IIS articles
    My PHP articles
    My How-to guides
  • 04-14-2009, 6:05 PM In reply to

    • DavidRPotter
    • Not Ranked
    • Joined on 04-14-2009, 3:02 AM
    • Bothell, WA (near Seattle)
    • Posts 10

    Re: PHP warning: "Could not execute mail delivery program"

    That was a good suggestion, Dominic, thanks.  I am able to produce the error now by executing the PHP script from the command line.  The issue appears to be that PHP is not providing a FROM address.  I'll following up on a PHP forum.

    Thanks,
    David

    Technical blog - http://DPotter.net/Technical/
  • 04-15-2009, 10:03 AM In reply to

    • Joanner
    • Not Ranked
    • Joined on 04-15-2009, 1:45 PM
    • Posts 6

    Re: PHP warning: "Could not execute mail delivery program"

    I think you have missing the execute file sendmail.exe (is there in the folder :\Inetpub\sendmail\...?) or try remove argument -t

     

  • 04-15-2009, 11:42 AM In reply to

    • DavidRPotter
    • Not Ranked
    • Joined on 04-14-2009, 3:02 AM
    • Bothell, WA (near Seattle)
    • Posts 10

    Re: PHP warning: "Could not execute mail delivery program"

    Sendmail.exe is where it is supposed to be and the argument -t is necessary for earlier versions but not the latest version, although it is allowed.  The problem has to do with PHP not providing the FROM address.  I haven't tracked down why it isn't doing that yet, though.

    Technical blog - http://DPotter.net/Technical/
  • 04-15-2009, 11:02 PM In reply to

    Re: PHP warning: "Could not execute mail delivery program"

    I'm having the same problem. I'm trying to send an email using PHP and IndigoMail. It works fine with Perl but I can't get it to work with PHP.

    Here's the error:


    Warning: mail() [function.mail]: Could not execute mail delivery program 'c:\sendmail\sendmail.exe -t' 

     

    Here's the PHP code:

    <?php

    $to = "mvanemmerik@comcast.net";
    $subject = "This is the subject";
    $message = "This is the message";

    mail($to, $subject, $message);
    ?>

     

    Here's the PHP.ini:

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

    ; For Win32 only.
    sendmail_from = mvanemmerik@comcast.net

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

     

    Here's the sendmail.ini:

     [OPTIONS]
    MAILSERVER=smtp.comcast.net
    FROM=mvanemmerik@comcast.net    
    REPLYTO=mvanemmerik@comcast.net
    REGKEY=none
    AUTHENTICATE=y
    USERNAME=mvanemmerik@comcast.net
    PASSWORD=password_here
    PORT=587

     Monty

     

Page 1 of 1 (6 items)
Microsoft Communities