如何使用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);
?>
#!/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);
?>
相关文章推荐
- Office 使用篇一:如何去掉 Word 文档的标记(含修订和批注)(即不显示已删除内容)
- webview加载的html文件,图片如何放大显示?
- 使用log4j,如何显示exception的详细内容
- bootstrap模态框modal使用remote第二次加载显示相同内容解决办法
- bootstrap模态框modal使用remote第二次加载显示相同内容解决办法
- 如何使用GDB显示不同C文件中的同名结构体内容
- BootStrap tabs标签 使用fade效果首次加载页面不能显示内容
- 如何使用JS实现页面内容随机显示
- 在看官方的例子时候由一个grid实例,在每一行之前有个加号,展开可以显示内容,在实际应用中还是非常有用的,照搬例子的代码,发现老是提示对象不存在,查阅资料后发现是没有加载插件,这里和大家分享下Ext.grid.RowExpander插件的使用,
- WKWebView加载Html文件,如何自适应网页内容呢?就是不要让它左右滑动
- Win10如何使用禁用cleartype以清晰地显示屏幕内容
- webview加载的html文件,图片如何放大显示?
- 如何添加使用echats地图悬浮显示内容
- 如何实现在页面上所有内容加载完之前一直显示loading...页面?
- WPF中使用流文档灵活地显示内容 (转载)
- 【转】使用母版页时内容页如何使用css和javascript
- 关于EASYUI使用dataGrid加载本地JSON文件浏览器不显示问题
- 如何使用DirectDraw直接显示RGB、YUV视频数据(播放yuv)
- 当图片URL为404时,使用Glide加载图片,修改用户头像无法显示最新图片bug
- C#判断用户是否使用微信浏览器,并据此来显示真实内容或二维码