|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-24 08:03 UTC] sascha dot winkler at ks dot sel dot alcatel dot de
I had first the bug with id 12024 and I have fixed it like described in the bug report.
Now I can send mails, but the mail() function returns false altough the mail was sent.
I use the following script to test the mail() function.
<?php
$mail_to = "sascha.winkler@t-online.de";
$mail_subject = "PHP test mail() gesendet obwohl failed gemeldet.";
$mail_body = " i hope that this mail() function works ! \n";
$mail_body .= " this is supposed to come on the second line \n";
$mail_body .= " and this on the third line \n";
if (mail($mail_to, $mail_subject, $mail_body))
echo "Successfully sent the email \"$mail_subject\" to $mail_to .";
else echo "Failed to send the e-mail \"$mail_subject\"." ;
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 02:00:01 2025 UTC |
More information: Basically, the mail function was returning false even though the email was being sent. Here is an example: if ( mail( 'glen@designsolution.co.uk', 'test', 'test2', "From: webmaster@$SERVER_NAME\r\nReply-To: webmaster@$SERVER_NAME\r\nX-Mailer: PHP/" . phpversion(), "-fstupid@webapproval.co.uk" ) ) { echo "mail sent okay"; } else { echo "mail cannot be sent!"; } The problem only occurs if you include the 5th parameter and the -f email address is not set up on the local machine. For example, PHP is running on the same machine as the webapproval.co.uk domain. If the user 'stupid' hasn't been set up, then sendmail will complain: sendmail[21956]: JAA21956: setsender: stupid@webapproval.co.uk: invalid or unparseable, received from httpd@localhost but will still send the mail. So essentially, sendmail is returning an error code, but still sending the mail. The return address is set to httpd@<my server address>.