Re: question about setting email parameters
| From: | Andy Hoffman | Date: | Wed, 01 Nov 2000 15:38:36 +0000 |
| Subject: | Re: question about setting email parameters | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-3622@lists.php.net to get a copy of this message | ||
"David P. Schwartz" wrote:
> For example, how would one prepare headers for something like the following:
>
> To: john@abc.com, bill@def.net, sam.sneed@xyz.aaa.com
> CC: sue@aol.com, tim@billsplace.com
> BCC: tom@billandted.com, cindy@anotherone.com
> From: joe@joesplace.org
> ReplyTo: jumpnjoe@edsdiner.com
> Subject: today's meeting
> Message: we had a really great meeting today! Wish you were here. -joe
The mail function uses the following FULL syntax, where $recipient is a string
(can be comma-separated) of recipient(s), $subject is the message submject (the
Subject: line), $message is the message body, and $headers are any ADDITIONAL
headers you wish to send (this string is new-line separated between individual
headers) -
mail($recipient, $subject, $message, $headers);
So, for your example, we'd do this...
<?php
$recipient = "john@abc.com, bill@def.net, sam.sneed@xyz.aaa.com";
$subject = "today's meeting";
$message = "we had a really great meeting today! Wish you were here. -joe";
$headers = "From: joe@joesplace.org\n";
$headers .= "cc: sue@aol.com, tim@billsplace.com\n";
$headers .= "bcc: tom@billandted.com, cindy@anotherone.com\n"
$headers .= "Reply-To: jumpnjoe@edsdiner.com\n";
mail($recipient, $subject, $message, $headers);
?>
The key thing to remember here is the fact that $headers contains ANY other
headers besides "To:", "Subject:" and the message text, and that this $headers
string is simply a newline (\n) separated string with each header on a separate
line (From, cc, bcc, etc.).
Make sense?
--
Andy Hoffman
Web Developer
Bristol-Myers Squibb
email: andy.hoffman@bms.com