PHP Forums Archive

Multiple e-mail recipients on PHP form script

Tags: n/a

jmac0814 posted on 2011-03-26 15:26:09 #

I need help. I can not for the life of me figure out how to add a second (or even a third) e-mail recipient to my script on a form. This is what I have:
Name: $form_name
Address: $form_address
Phone: $form_phone
E-mail: $form_email
";

$email = "anyone@anywhere.com";

With just the one line it works no problem. I have tried side by side with a semi colon between but only the first one recieved it, a comma returns a syntax error, and I have stacked them like this:
$email = "anyone@anywhere.com";
$email = "anyone@anywhere.com";

and that didnt work either. Any suggestions?

Comments / discussions

Olaf posted on 2011-03-26 22:32:09 #

Hi,

using PHP's mail function you need to add the function into a loop.

Just create an array of email addresses and loop through this array and send each one the message.