some reformatting, use example.com for example email addresses. (now i know where all those stupid messages bouncing off birthday@php.net came from.)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@61276 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
jim winstead 2001-10-31 22:45:43 +00:00
parent f1883aab78
commit 3c81bc5fb3

View file

@ -1,5 +1,5 @@
<?xml encoding="iso-8859-1"?>
<!-- $Revision: 1.29 $ -->
<!-- $Revision: 1.30 $ -->
<reference id="ref.mail">
<title>Mail functions</title>
<titleabbrev>Mail</titleabbrev>
@ -41,18 +41,17 @@
accomplished via MIME-encoding - for more information, see
<ulink url="http://www.zend.com/zend/spotlight/sendmimeemailpart1.php"
>http://www.zend.com/zend/spotlight/sendmimeemailpart1.php</ulink> or
RFC 1896 (Visit <ulink url="http://www.rfc-editor.org/"
>http://www.rfc-editor.org/</ulink>).
<ulink url="&url.rfc1896;">RFC 1896</ulink>).
</simpara>
<para>
<function>mail</function> returns &true; if the mail
is sucessfully sent, &false; otherwise.
is successfully sent, &false; otherwise.
</para>
<para>
<example>
<title>Sending mail.</title>
<programlisting>
mail("rasmus@lerdorf.on.ca", "My Subject", "Line 1\nLine 2\nLine 3");
mail("joecool@example.com", "My Subject", "Line 1\nLine 2\nLine 3");
</programlisting>
</example></para>
<simpara>
@ -77,16 +76,17 @@ mail("rasmus@lerdorf.on.ca", "My Subject", "Line 1\nLine 2\nLine 3");
<example>
<title>Sending mail with extra headers.</title>
<programlisting>
mail("nobody@aol.com", "the subject", $message,
mail("nobody@example.com", "the subject", $message,
"From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion());
</programlisting>
</example>
With the fifth parameter you can set additional command line parameters to
the actual mailer. In the example below we set the correct Return-Path
header for sendmail. Normally sendmail will add the X-Authentication-Warning
header when using the -f parameter, because the webserver user is probably
not a member of the trusted users. To suppress this warning, you should add
the web server user to the trusted users in your sendmail config file.
With the fifth parameter you can set additional command line
parameters to the mail program. In the example below we set the
correct Return-Path header when using sendmail. Normally sendmail
will add the X-Authentication-Warning header when using the -f
parameter, because the webserver user is probably not a member of
the trusted users. To suppress this warning, you should add the web
server user to the trusted users in your sendmail configuration file.
</para>
<note>
<para>
@ -97,7 +97,7 @@ mail("nobody@aol.com", "the subject", $message,
<example>
<title>Sending mail with extra headers and setting an additional command line parameter.</title>
<programlisting>
mail("nobody@aol.com", "the subject", $message,
mail("nobody@example.com", "the subject", $message,
"From: webmaster@$SERVER_NAME", "-fwebmaster@$SERVER_NAME");
</programlisting>
</example>
@ -107,9 +107,8 @@ mail("nobody@aol.com", "the subject", $message,
<title>Sending complex email.</title>
<programlisting>
/* recipients */
$recipient .= "Mary &lt;mary@u.college.edu>" . ", " ; //note the comma
$recipient .= "Kelly &lt;kelly@u.college.edu>" . ", ";
$recipient .= "ronabop@php.net";
$recipient .= "Mary &lt;mary@example.com&gt;" . ", " ; //note the comma
$recipient .= "Kelly &lt;kelly@example.com&gt;";
/* subject */
$subject = "Birthday Reminders for August";
@ -121,22 +120,22 @@ $message .= "3rd \t\tAug \t\t1970\n";
$message .= "17rd\t\tAug \t\t1973\n";
/* you can add a stock signature */
$message .= "--\r\n"; //Signature delimiter
$message .= "Birthday reminder copylefted by public domain";
$message .= "-- \r\n"; //Signature delimiter
$message .= "Birthday reminder";
/* additional header pieces for errors, From cc's, bcc's, etc */
$headers .= "From: Birthday Reminder &lt;birthday@php.net>\n";
$headers .= "X-Sender: &lt;birthday@php.net>\n";
$headers .= "From: Birthday Reminder &lt;birthday@example.com&gt;\n";
$headers .= "X-Sender: &lt;birthday@example.com&gt;\n";
$headers .= "X-Mailer: PHP\n"; // mailer
$headers .= "X-Priority: 1\n"; // Urgent message!
$headers .= "Return-Path: &lt;birthday@php.net>\n"; // Return path for errors
$headers .= "Return-Path: &lt;birthday@example.com&gt;\n"; // Return path for errors
/* If you want to send html mail, uncomment the following line */
// $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type
/* To send HTML mail, you can set the Content-type header. */
// $headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "cc: birthdayarchive@php.net\n"; // CC to
$headers .= "bcc: birthdaycheck@php.net, birthdaygifts@php.net"; // BCCs to
$headers .= "Cc: birthdayarchive@example.com\n";
$headers .= "Bcc: birthdaycheck@example.com\n";
/* and now mail it */
mail($recipient, $subject, $message, $headers);
@ -173,7 +172,7 @@ mail($recipient, $subject, $message, $headers);
<example>
<title>Calculating the hash and subscribing a user</title>
<programlisting>
$user = "kris@koehntopp.de";
$user = "joecool@example.com";
$hash = ezmlm_hash ($user);
$query = sprintf ("INSERT INTO sample VALUES (%s, '%s')", $hash, $user);
$db->query($query); // using PHPLIB db interface