Jump to content

How to get my .php form to email multiple recipients


reflex84

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 :)

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...