PHP mail function - need help with headers

Hey,

I am using the code below. I am wanting to not send the CC when sending emails, as it generates a long list of emails in the header, how can I block the mail function from sending CC and send it as BC or not send any of this header type…?


		$headers .= "From: ".$from."\\r\
";
		$headers .= "MIME-Version: 1.0\\r\
";
		$headers .= "Content-Type: text/html; charset=ISO-8859-1\\r\
";

		if (mail($to,$subject,$message,$headers) ) {
			return true;
		} else {
			return false;
		}

So your code looks like…


        $headers .= "From: ".$from."\\r\
";
        $headers .= "MIME-Version: 1.0\\r\
";
        $headers .= "Content-Type: text/html; charset=ISO-8859-1\\r\
";
        $headers .= "Bcc:".[COLOR="Red"]$to[/COLOR]."\\r\
"; 
        if (mail([COLOR="Red"]$to[/COLOR],$subject,$message,$headers) ) {

if so, you need to change that second $to into something that doesnt give anything away. Like..."noreply@yoursite.com"

its showing all the emails in the header of the email…

If I remove the $to parameter from the mail function, this means that it wont send any emails?

It’s sending out the BCC header? Or are you still sending $to into the “To” element of the mail command?

I added a new header (see below) but it still sends out all the emails in the header - is there any way to block it… or make sure only Bcc is active not CC


		$headers .= "From: ".$from."\\r\
";
		$headers .= "MIME-Version: 1.0\\r\
";
		$headers .= "Content-Type: text/html; charset=ISO-8859-1\\r\
";
		$headers .= "Bcc:".$to."\\r\
";

Be careful of doing this - if you’ve got too many addresses in the email, your mail server may reject sending it as spam.

That said, a BCC header is formed as a comma seperated list, on a single line:

"Bcc: address1@blah.com, address2@blah.com \r
"