PHP doesn't seem to be reading/paying attention to the smtp settings in php.ini. The settings in php.ini are as follows:

[mail function]
; For Win32 only.
SMTP = smtp.idcomm.com
smtp_port = 25
sendmail_from = ecommerce@idcomm.com

But phpinfo() shows this (sorry it's not as pretty as the orginal):

SMTP. . . . . . . . . . . .localhost . . . localhost
smtp_port . . . . . . .25 . . . . . . . . .25
sendmail_from . . . no value . . . .no value

When I try to use the mail() function, I get:

Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Web Sites\Business\sshtest\test.php on line 171
Unable to send mail.

Even though I'm using the following code and trying to send a From header:

$to = "webdev@idcomm.com";
$subject = "Test mail from ecommerce website";
$msg = "This is a test from sshtest.com on ecommerce.  Let's see if it gets through.";
$from = "From: ecommerce@idcomm.com";
if (mail($to, $subject, $msg, $from)) {
   echo "Mail sent successfully.";
} else {
   echo "Unable to send mail.";
}

Any ideas would be appreciated....

  • Scott
    a month later

    Okay, so I happened to have occasion to use PHP from a command line recently. I got an error running it that way that never showed up or got logged when IIS started. Apparently it had trouble parsing a line in the php.ini file and just gave up at that point. So anything before that line was used, but nothing after. Upon fixing the parse error of course, it now reads the entire file just fine.

      11 days later
      scotthco wrote:

      Okay, so I happened to have occasion to use PHP from a command line recently. I got an error running it that way that never showed up or got logged when IIS started. Apparently it had trouble parsing a line in the php.ini file and just gave up at that point. So anything before that line was used, but nothing after. Upon fixing the parse error of course, it now reads the entire file just fine.

      First thing I do after making any changings to PHP is run php.exe via cmd to see if it chokes.

        Write a Reply...