Re: mail function problem



Does this little test give you any errors:

<?

error_reporting(E_ALL);

// Change this:
$to = 'someEmailAddressBlah@xxxxxxxxx';

$file = '/tmp/test.txt';
$fh = fopen($file, 'w') or die('fopen');
fwrite($fh, "Subject: Test\r\nTo: $to\r\nHi.\n");
fclose($fh) or die('fclose');

$sm = ini_get('sendmail_path');
echo "Sending mail using $sm.<br>";
$cmd = "$sm < $file 2>&1";
exec($cmd, $output, $exitCode);
if ($exitCode != 0) {
echo "Command \"$cmd\" failed with exit code $exitCode: " .
join("\n", $output) . "<br>";
} else {
echo "Successfully sent mail.<br>";
}

?>

On Jun 29, 8:12 am, w...@xxxxxxxxxxxxxx wrote:
Hi,

I'm running PHP 5.2.3 on Solaris 10 (AMD64).

My mail function doesn't send any mail, the return value of mail
function is false...
But sendmail_path value is OK in php.ini, and I've tried to send a mail
with sendmail on console with the same user (the apache user), and
everything's ok...

Does anyone have solution ?

Thanks for help.


.



Relevant Pages

  • Re: [PHP] mail function problem
    ... I'm running PHP 5.2.3 on Solaris 10. ... My mail function doesn't send any mail, the return value of mail function is false... ... But sendmail_path value is OK in php.ini, and I've tried to send a mail with sendmail on console with the same user (the apache user), and everything's ok... ... Check your mail logs and your apache logs to see if any errors are showing up. ...
    (php.general)
  • mail function problem
    ... I'm running PHP 5.2.3 on Solaris 10. ... My mail function doesn't send any mail, the return value of mail function is false... ... But sendmail_path value is OK in php.ini, and I've tried to send a mail with sendmail on console with the same user (the apache user), and everything's ok... ...
    (php.general)
  • Re: Problems with mail function
    ... > Right now I have a problem with the mail function. ... > This same code was working on my old server. ... No errors are appearing in the PHP error log ... If I use the exec function to manually call sendmail it works ...
    (comp.lang.php)
  • Re: [PHP] mail function from and reply to address problem
    ... mail function returns 1whether or not i'm sending to the new virtual ... host domain name or any random domain name. ... sendmail problem... ... >>> PHP 5.1.4 ...
    (php.general)
  • Re: mail reports success but nothing happens
    ... You should use the default value for this and let ssmtp to be run with the sendmail alias. ... I use the mail function in php, it returns true but I never receive the ... emerge -C ssmtp && emerge sendmail ...
    (alt.php)