Skip to content

Instantly share code, notes, and snippets.

@wrongkitchen
Last active December 10, 2015 06:39
Show Gist options
  • Save wrongkitchen/4395935 to your computer and use it in GitHub Desktop.
Save wrongkitchen/4395935 to your computer and use it in GitHub Desktop.
<?php
$file = "index.html";
if(!file_exists($file)) die("File Not Found");
$bodyhtml = "";
$fp = fopen($file,"r");
while(!feof($fp)){
$bodyhtml.=fgets($fp,4096);
}
fclose($fp);
//$bodyhtml = preg_replace("/[\t\s]+/","",$bodyhtml);
$bodyhtml = str_replace('"images/','"http://xxx.com/xxx/images/',$bodyhtml);
$Subject = "EDM";
$array = array(
'xxx@xxx.com',
//,'xxx@xxx.com'
//,'xxx@xxx.com'
//,'xxx@xxx.com'
);
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= "From: SONY EDM <sony_edm@sony_edm.com.hk>";
foreach($array as $idx => $to){
echo "<p>Sending email to &quot;$to&quot;...";
if (mail($to, $Subject, $bodyhtml, $headers )){
echo "Message successfully sent!";
}
else {
echo "Message delivery failed";
}
echo "</p>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment