diff --git a/functions/mail.xml b/functions/mail.xml index d9f9578575..bb5991fc92 100644 --- a/functions/mail.xml +++ b/functions/mail.xml @@ -1,5 +1,5 @@ - + Mail functions Mail @@ -41,18 +41,17 @@ accomplished via MIME-encoding - for more information, see http://www.zend.com/zend/spotlight/sendmimeemailpart1.php or - RFC 1896 (Visit http://www.rfc-editor.org/). + RFC 1896). mail returns &true; if the mail - is sucessfully sent, &false; otherwise. + is successfully sent, &false; otherwise. Sending mail. -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"); @@ -77,16 +76,17 @@ mail("rasmus@lerdorf.on.ca", "My Subject", "Line 1\nLine 2\nLine 3"); Sending mail with extra headers. -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()); - 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. @@ -97,7 +97,7 @@ mail("nobody@aol.com", "the subject", $message, Sending mail with extra headers and setting an additional command line parameter. -mail("nobody@aol.com", "the subject", $message, +mail("nobody@example.com", "the subject", $message, "From: webmaster@$SERVER_NAME", "-fwebmaster@$SERVER_NAME"); @@ -107,9 +107,8 @@ mail("nobody@aol.com", "the subject", $message, Sending complex email. /* 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); Calculating the hash and subscribing a user -$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