Re: Mail / Mail_mime, Cc, and Exchange
| From: | Matthew Weier O'Phinney | Date: | Sat, 19 Mar 2005 20:07:25 +0000 |
| Subject: | Re: Mail / Mail_mime, Cc, and Exchange | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18153@lists.php.net to get a copy of this message | ||
* Michael Caplan <michael.caplan@lechateau.ca>:
> I am having some difficulty figuring out why Email with Cc or Bcc headers
> sent with PEAR::Mail and PEAR::Mail_mime are being ignored using a direct
> SMTP connection to an Exchange 5 box (the email is being delivered to the
> proper To recipient). Has anyone else experienced this?
> A sample of what my code looks like:
> $headers =3D array();
>
> $headers['From'] =3D 'Intranet Tracking <' .
> $fw_ini['tracking.from'] . '>';
>
> $headers['Subject'] =3D 'Nouvel article sur l\'Intranet / New Item on the
> Intranet';
>
> $headers['Cc'] =3D $fw_ini['tracking.cc'];
>
> $headers['x-tracking-item-id'] =3D $this->tracking_id;
>
> $headers['x-tracking-item-level'] =3D $this->level_id;
>
> =20
>
> $mime =3D new Mail_mime();
>
> $mime->setHTMLBody($body);
>
> $body =3D $mime->get();
>
> $res =3D $sendmail->send($email, $mime->headers($headers), $body);
>
> Am I missing something here?
Yes. The send() method's first argument should be either a string (a
single email) or an array of email addresses to which the message should
be sent. This parameter should include *all* addresses to which the
email should be sent -- including Cc and Bcc addresses. Setting the
headers is not enough to accomplish this.
What you'll need to do is something like:
$recip = array($email, $fw_ini['tracking.cc']);
$sendmail->send($recip, $mime->headers($headers), $body);
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org