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
This commit is contained in:
Aidan Lister 2005-04-28 12:57:53 +00:00
parent 3f982c10ec
commit cfb04bdbdc

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.31 $ -->
<!-- $Revision: 1.32 $ -->
<refentry id="function.mail">
<refnamediv>
<refname>mail</refname>
@ -92,16 +92,29 @@ $text = str_replace("\n.", "\n..", $text);
<para>
This is typically used to add extra headers (From, Cc, and Bcc).
Multiple extra headers should be separated with a CRLF (\r\n).
<note>
<para>
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
<ulink url="&url.rfc;2822">RFC 2822</ulink>.
</para>
</note>
</para>
<note>
<para>
When sending mail, the mail <emphasis>must</emphasis> contain
a <literal>From<literal> header. This can be set with the
<parameter>additional_headers</parameter> parameter, or a default
can be set in &php.ini;.
</para>
<para>
Failing to do this will result in an error
message similar to <literal>Warning: mail(): "sendmail_from" not
set in php.ini or custom "From:" header missing</literal>.
</para>
</note>
<note>
<para>
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
<ulink url="&url.rfc;2822">RFC 2822</ulink>.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
@ -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);
<![CDATA[
<?php
mail('nobody@example.com', 'the subject', 'the message', null,
'-fwebmaster@' . $_SERVER['SERVER_NAME']);
'-fwebmaster@example.com');
?>
]]>
</programlisting>