您的位置:首页 > Web前端 > HTML

如何使用Email下发来加载显示HTML文件的内容

2012-02-20 15:25 323 查看
#该脚本主要是实现如何使用PHP来进行Email发送HTML,并显示该Email的HTML内容

#!/usr/bin/php   -q 

<? 

$email="xx@gmai.com";

$error_log="统计下发邮件不存在,请检查统计、导入文件是否正常!";

$email_Maintenance="xx@gmai.com";

$email_t_spm_mart="xx@gmai.com";

$file_tj=fopen("/home/whm/everyday_statistical.html","r");

$file=fopen("/home/whm/yncxdyj_excute_Judge.log","r");

$spm_mart=fopen("/home/whm/everyday_t_spm_mart.html","r");

send_email_tj($email,$file_tj);

send_email_spm_mart($email_t_spm_mart,$spm_mart);

function send_email_tj($email,$file_tj){ 

$header= "Content-type:text/html;charset=gb2312\r\n "; 

$header .='From:<"xx@gmai.com">' ."\r\n "; 

$from= "xx@gmai.com";

$subject= "日常短彩信大赢家统计(统计截至时间是2天前)"; 

$message=" <html><body> "; 

$message .= " <br> <br><h1><center>日常短彩信大赢家统计列表<center></h1> <br> <br> ";
$message .=$file_tj;

#上面几下面的都可以不看,主要是通过PHP的函数来实现,是不是非常简单

while (!feof($file_tj)) 

  { 

  $message .=fgetc($file_tj); 

  }

fclose($file_tj);

$message .= "<br></body></html> "; 

mail($email,$subject,$message,$header) or die( "Sorry,Failure "); 

};

$f="/home/whm/yncxdyj_excute_Judge.log";

if (file_exists($f)) {

  send_email_Maintenance($email_Maintenance,$file);

  $num=unlink($f);

} else send_error($email_Maintenance,$error_log);

?> 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐