Sending an Email to Multiple Recipients - Cc: and Bcc: in php

mstewart1409

New Member
This program is running but how to send multiple CC and BCC.\[code\]for($i = 0; $i < count($snteadd); $i++){ $subjt = $subject; $mess = $message; $toinfo .= $snteadd[$i]; $headers = "MIME-Version: 1.0 \r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "from: <$fromemailid>\r\n"; $headers .= "Reply-To: <$fromemailid>\r\n"; $hedders .= "cc : <$sendCC>\r\n" ; $headers .= "Bcc : <$sendBCC>\r\n"; $headers .= "X-Mailer: PHP 4.x"; $sendbcc = $snteadd[$i] .","; $sendbcc .= $sendCC . ","; $sendbcc .= $sendBCC; if($jvl != $i) { $toinfo .= ", "; } if($snteadd[$i] != "") { $result = mail($sendbcc, $subjt, $mess, $headers); if(!$result) { $subjdis = "Auto Response for Message Sending Failed"; $headersdis = "MIME-Version: 1.0\r\n"; $headersdis .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headersdis .="Message Sending Failed\r\n"; $headersdis .= "From: <$fromemailid> \r\n"; $msgdis = "Message Could not be Delivered to this Mail ID ".$snteadd[$i]; mail($fromemailid, $subjdis, $msgdis, $headersdis); print "We encountered an error sending your mail <br>"; //echo $headersdis; } }}\[/code\]
 
Back
Top