mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Cleaner example
$headers change integrated from comment 108368 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@341357 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
d6f70a11b9
commit
f10ab85a29
1 changed files with 12 additions and 13 deletions
|
@ -272,14 +272,13 @@ mail('nobody@example.com', 'the subject', 'the message', null,
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// multiple recipients
|
||||
$to = 'aidan@example.com' . ', '; // note the comma
|
||||
$to .= 'wez@example.com';
|
||||
// Multiple recipients
|
||||
$to = 'johny@example.com, sally@example.com'; // note the comma
|
||||
|
||||
// subject
|
||||
// Subject
|
||||
$subject = 'Birthday Reminders for August';
|
||||
|
||||
// message
|
||||
// Message
|
||||
$message = '
|
||||
<html>
|
||||
<head>
|
||||
|
@ -292,7 +291,7 @@ $message = '
|
|||
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
|
||||
<td>Johny</td><td>10th</td><td>August</td><td>1970</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
|
||||
|
@ -303,17 +302,17 @@ $message = '
|
|||
';
|
||||
|
||||
// To send HTML mail, the Content-type header must be set
|
||||
$headers = 'MIME-Version: 1.0' . "\r\n";
|
||||
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
|
||||
$headers[] = 'MIME-Version: 1.0';
|
||||
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
|
||||
|
||||
// Additional headers
|
||||
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
|
||||
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
|
||||
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
|
||||
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
|
||||
$headers[] = 'To: Mary <mary@example.com>, Kelly <kelly@example.com>';
|
||||
$headers[] = 'From: Birthday Reminder <birthday@example.com>';
|
||||
$headers[] = 'Cc: birthdayarchive@example.com';
|
||||
$headers[] = 'Bcc: birthdaycheck@example.com';
|
||||
|
||||
// Mail it
|
||||
mail($to, $subject, $message, $headers);
|
||||
mail($to, $subject, $message, implode("\r\n", $headers));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue