Re: Multiple Recipients (MAIL)

From: Date: Mon, 21 Feb 2005 21:39:36 +0000
Subject: Re: Multiple Recipients (MAIL)
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17609@lists.php.net to get a copy of this message
* Brett Patterson <brett2@umbc.edu>: > ------=_NextPart_000_0028_01C5182A.275BD530 > I was wondering how I would go about doing this (yes I've read the manual, > but have questions): > > I want to send an email to a recipient, and Cc it back to the writer. The > recipient is not always static, as well as the writer is not static. > > I have tried including the $headers['To'] = $Recip; $headers['Cc'] = > $Name." > <".$Email.">" but that doesn't work. It gives me the right headers, > but the > wrong To: line: > > To: webmaster@domain.com; name@domain.com; webmaster@domain.com; > > Cc: name@domain.com; > > > > What is the best way to Cc an email using the PEAR::Mail class so that the > email headers are formatted: > > To: webmaster@domain.com > > Cc: Full Name <name@domain.com>? $headers = array( 'To' => 'webmaster@domain.com', 'Cc' => 'Full Name <name@domain.com>', // you probably need a few more headers, too ); Then... make sure your recipients are passed to send() as an array of email addresses. This array should include EVERYONE who will be receiving the email -- those in the To, and/or Cc, and/or Bcc lines: $recips = array( 'webmaster@domain.com', 'name@domain.com' ); $mail->send($recips, $headers, $message); -- 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

« previous php.pear.general (#17609) next »