Page 1 of 1

Newbie question

Posted: Wed Mar 15, 2006 2:26 pm
by kh
Hello,

I'm primarily a designer with very little PHP experience. However, I have to get a PHP mailform working. There is a legacy backend from the previous person who worked on the site. I got it working, but need to add multiple recipients. It now works with one additional email address, but not more than that. I need to be able to add several. The code snippet I'm having trouble with is here:

Code: Select all

$sendTo = "recipient1@address1.com" . ", ";
$sendTo .= "recipient2@address2.com";
I'm not sure how to alter the code to add additional recipients (i.e. "recipient3", etc.) after this. I tried all kinds of variations on the above, but I've had no luck. Can anyone please provide some direction?

Thanks,

--kh

Posted: Wed Mar 15, 2006 2:38 pm
by feyd
Multiple recipients can be added through the headers parameter.

Code: Select all

'To: ' . implode(',', $someArrayOfRecipients);
If memory serves.