From cfb04bdbdcc3a7bd9fd3c7a44099c962e2c476de Mon Sep 17 00:00:00 2001 From: Aidan Lister Date: Thu, 28 Apr 2005 12:57:53 +0000 Subject: [PATCH] Add a little more info about sendmail_from git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@185357 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mail/functions/mail.xml | 39 ++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/reference/mail/functions/mail.xml b/reference/mail/functions/mail.xml index 266f3d96cf..c6757f7b9c 100644 --- a/reference/mail/functions/mail.xml +++ b/reference/mail/functions/mail.xml @@ -1,5 +1,5 @@ - + mail @@ -92,16 +92,29 @@ $text = str_replace("\n.", "\n..", $text); This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n). - - - If messages are not received, try using a LF (\n) only. - Some poor quality Unix mail transfer agents replace LF by CRLF - automatically (which leads to doubling CR if CRLF is used). - This should be a last resort, as it does not comply with - RFC 2822. - - + + + When sending mail, the mail must contain + a From header. This can be set with the + additional_headers parameter, or a default + can be set in &php.ini;. + + + Failing to do this will result in an error + message similar to Warning: mail(): "sendmail_from" not + set in php.ini or custom "From:" header missing. + + + + + If messages are not received, try using a LF (\n) only. + Some poor quality Unix mail transfer agents replace LF by CRLF + automatically (which leads to doubling CR if CRLF is used). + This should be a last resort, as it does not comply with + RFC 2822. + + @@ -216,8 +229,8 @@ mail('caffinated@example.com', 'My Subject', $message); $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; -$headers = 'From: webmaster@' . $_SERVER['SERVER_NAME'] . "\r\n" . - 'Reply-To: webmaster@' . $_SERVER['SERVER_NAME'] . "\r\n" . +$headers = 'From: webmaster@example.com' . "\r\n" . + 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); @@ -236,7 +249,7 @@ mail($to, $subject, $message, $headers); ]]>