Forum Moderators: coopster

Message Too Old, No Replies

mail() function and bcc. I hope this helps someone.

work around to send bcc through php mail( )

         

indiguy

6:36 am on Oct 8, 2009 (gmt 0)

10+ Year Member



My contribution: I hope its helpful
It works :)

The main() function can only handle $To, $from, $subject and some page formatting $headers. Bcc is not handled due to abuse and many servers hinder the use of it for that reason.

Therefore, I enclosed another mail() function inside another set of php open and close <? ?> tags, and instead of setting $to in it, i put $bcc in it. For the manager of the business to see where the main message was sent to, I inserted $destination_address which has the $to variable passed into it.
It works great.

-----------------------------------------------
------------------------------------------------
$headers .= "From: \"$from\"\r\n";
$destination_address = "To: \"$to\"\r\n";
// main email
mail($to, $subject, $message, $headers, "MINE-Version: 1.0"."Content-type: text/html; charset=iso-8859-1");
?>

<?php echo $ip;
// blind carbon copy:
mail( $bcc_email, $destination_address, $subject, $message, "MINE-Version: 1.0"."Content-type: text/html; charset=iso-8859-1"); ?>

dreamcatcher

6:17 am on Oct 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi indiguy,

Thanks for sharing. I think many people just go with the free PHP Mailer system, which solves many mailing problems.

dc

rocknbil

3:32 pm on Oct 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"MINE-Version: 1.0"

You want MIME-Version here to properly report the mime version to the receiving client.