Re: PEAR mail
| From: | Matthew Weier O'Phinney | Date: | Mon, 08 Nov 2004 16:36:42 +0000 |
| Subject: | Re: PEAR mail | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201546@lists.php.net to get a copy of this message | ||
* Marc Serra <mserra@gdwd.com>:
> i'm using Mail PEAR package and i want to send a mail to a recipient and
> to some other in Cc.
> So i try to add Cc in header but it failed and mail didn't been
> delivered to Cc. It was only delivered to adress specified in From field.
>
> I use that code :
>
>
> $hdrs = array(
> "From" => "adresse1@test.com",
> "Cc" => "adresse2@test.com"
^
Need a comma at the end of that line.
> "Subject" => "Tests"
> );
> $mime = new Mail_mime($crlf);
> $mime->setHTMLBody(stripslashes($html));
> $body = $mime->get();
> $hdrs = $mime->headers($hdrs);
> $mail =& Mail::factory('smtp',$params);
> $mail->send($recipients, $hdrs, $body);
What is $recipients? Is it an array with both adresse1@test.com and
adresse2@test.com? or a comma-separated string with both addresses?
Those are the two accepted forms for the first argument to the send()
method. The common pitfall I run into is that I forget to add the Cc
and/or Bcc elements to it before sending -- which means they do not get
delivered.
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org