Newbie question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kh
Forum Newbie
Posts: 1
Joined: Wed Mar 15, 2006 2:16 pm

Newbie question

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Multiple recipients can be added through the headers parameter.

Code: Select all

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