diff --git a/functions/mail.xml b/functions/mail.xml index 3e609a96ac..87d71747ff 100644 --- a/functions/mail.xml +++ b/functions/mail.xml @@ -20,14 +20,18 @@ string to string subject string message - string additional_headers + string + additional_headers + + Mail automatically mails the message specified in message to the receiver specified in to. Multiple recipients can be specified by - putting a comma between each address in to. + putting a comma between each address in to. + Sending mail. @@ -46,7 +50,48 @@ mail("rasmus@lerdorf.on.ca", "My Subject", "Line 1\nLine 2\nLine 3"); mail("nobody@aol.com", "the subject", $message, "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" . phpversion()); - + + You can also use fairly simple string building techniques to + build complex email messages. + + Sending complex email. + +/* recipients */ +$recipient .= "Mary <mary@u.college.edu>" . ", " ; //note the comma +$recipient .= "Kelly <kelly@u.college.edu> . ", "; +$recipient .= "ronabop@php.net"; + +/* subject */ +$subject = "Birthday Reminders for August"; + +/* message */ +$message .= "The following email includes a formatted ASCII table\n"; +$message .= "Day \t\tMonth \t\tYear\n"; +$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"; + +/* 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 .= "X-Mailer: PHP\n"; // mailer +$headers .= "X-Priority: 1\n"; // Urgent message! +$headers .= "Return-Path: <birthday@php.net>\n"; // Return path for errors + +$headers .= "Content-Type: text/html; charset=iso-8859-1\n" // Mime type + +$headers .= "cc:birthdayarchive@php.net\n"; // CC to +$headers .= "bcc:birthdaycheck@php.net, birthdaygifts@php.net\n"; // BCCs to + +/* and now mail it */ +mail($recipent, $subject, $message, $headers); + + +