Sending an Email to Multiple Recipients - Cc: and Bcc: in php -
this program running how send multiple cc , bcc.
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 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 not delivered mail id ".$snteadd[$i]; mail($fromemailid, $subjdis, $msgdis, $headersdis); print "we encountered error sending mail <br>"; //echo $headersdis; } } }
just comma-separated list of addresses should each field. note have number of typo's in code in question.
Comments
Post a Comment