Jump to content

How to get my .php form to email multiple recipients


reflex84
 Share

Recommended Posts

Hi,What do I put in my php form code, so that when someone fills in my online form, the form goes to more than, example 5 email addresses?Heres what my coding looks like:

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

As you can see, I've got a $bcc for a second email address, but how do I bcc more than email addresses?I tried:

$bcc = "me@xxxxxxxxxxxx.com; me@xxxxxxxxxxxx.com; me@xxxxxxxxxxxx.com";

... and this didn't workAny help?

Link to comment
Share on other sites

$to = "youremail@example.com";$headers = "From: " . $_POST['email'] . "\r\n"; $headers .= "bcc: someoneelse@example.com" . "\r\n";$headers .= "bcc: anotherperson@example.com" . "\r\n";

Hope that helps :)

Edited by real_illusions
Link to comment
Share on other sites

Only 1 BCC header is allowed. When in doubt, go to the source, this document tells you exactly how to format anything in an email:http://www.ietf.org/rfc/rfc2822.txtIf you search for "bcc" you'll find the description about that header, which takes an "address-list" (which you can also find defined in that document).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...