Re: Mail, array of recipients
| From: | Justin Patrin | Date: | Fri, 01 Oct 2004 20:32:15 +0000 |
| Subject: | Re: Mail, array of recipients | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14724@lists.php.net to get a copy of this message | ||
On Fri, 01 Oct 2004 22:27:07 +0200, DG <listsdg@yahoo.fr> wrote:
> Justin Patrin wrote:
> >
> >
> >Here, this will do exactly what you want:
> >
> >$mime = &new Mail_mime("\r\n");
> >$mime->setTXTBody($message);
> >$mime->setHTMLBody($html_message);
> >$body = $mime->get();
> >$headers['To'] = implode(', ', $recipients);
> >$hdrs = $mime->headers($headers);
> >$mailObj =& Mail::factory($driver,$options);
> >foreach ($recipients as $recipient) {
> > $result = $mailObj->send($recipient, $hdrs, $body);
> >}
> >
> >
> Thanks for the hint. But I don't want that each recipient can know
> others... I suppose the "to" field in the in received emails will
> presents all recipients with your implode method ?
>
> Is there any disadvantage in making a method
> setTo($to){$this->_headers['To'] = $to;} in mail_mime ?
>
No, I see no reason that would be bad. Put in a feature request for Mail_mime.
To do it now, use this, then.
$mime = &new Mail_mime("\r\n");
$mime->setTXTBody($message);
$mime->setHTMLBody($html_message);
$body = $mime->get();
$hdrs = $mime->headers($headers);
$mailObj =& Mail::factory($driver,$options);
foreach ($recipients as $recipient) {
$hdrs['To'] = $recipient;
$result = $mailObj->send($recipient, $hdrs, $body);
}
--
paperCrane --Justin Patrin--