mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
f1883aab78
commit
3c81bc5fb3
1 changed files with 25 additions and 26 deletions
|
@ -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 <mary@u.college.edu>" . ", " ; //note the comma
|
||||
$recipient .= "Kelly <kelly@u.college.edu>" . ", ";
|
||||
$recipient .= "ronabop@php.net";
|
||||
$recipient .= "Mary <mary@example.com>" . ", " ; //note the comma
|
||||
$recipient .= "Kelly <kelly@example.com>";
|
||||
|
||||
/* 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 <birthday@php.net>\n";
|
||||
$headers .= "X-Sender: <birthday@php.net>\n";
|
||||
$headers .= "From: Birthday Reminder <birthday@example.com>\n";
|
||||
$headers .= "X-Sender: <birthday@example.com>\n";
|
||||
$headers .= "X-Mailer: PHP\n"; // mailer
|
||||
$headers .= "X-Priority: 1\n"; // Urgent message!
|
||||
$headers .= "Return-Path: <birthday@php.net>\n"; // Return path for errors
|
||||
$headers .= "Return-Path: <birthday@example.com>\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
|
||||
|
|
Loading…
Reference in a new issue