Web Hosting Talk







View Full Version : Submit form to multiple emails using a PHP form


amberlong83
12-29-2009, 08:08 AM
Hello everyone

I want to submit a form to 2 email addresses.
I am using a php form

My html code for single email

$to = "address@email.com";
$from = $_POST['email'];
$subject = "Website Enquiry";

thanks in advance

Avalon Systems
12-29-2009, 08:17 AM
Simply change the following.

$to = "address@email.com";

to...

$to = "address@email.com, address2@email.com";

http://uk.php.net/manual/en/function.mail.php

amberlong83
12-29-2009, 08:26 AM
thanks for your suggesion

FreeKill
12-31-2009, 02:47 PM
You can also send to additional emails using CC and BCC if you need to. All you need to do is fill in the optional "headers" section of the call:

mail($to, $subject, $message, $headers);

with something like:

$headers = "Cc: bob@sendmeemail.com";