易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP mail Function With Attachments

原帖地址:http://www.zedwood.com/article/126/php-mail-function-with-attachments
This code sends an html formatted email with attachments. This email sending script actually sends both a plaintext and an html body of the email, allowing the email client to choose which to display. The plaintext email is generated by stripping html tags from the html formatted body, and replacing 
with newline characters. 
One of the nice things about this script is that the attachments are stored in an array. If you want to add another attachment, all you have to do is copy and past an existing line in the attachment array, and change the filename. 
For each attachment, it automatically looks up the corresponding mimetype.
$file1='test.pdf';
$file2='test2.tar.gz';
$head = array(
       'to'      =>array('email@email.net'=>'Admin',
                         'email2@email.net'=>'Admin2'),
       'from'    =>array('cron@55.66.77.88' =>'CronAgent'),
       'cc'      =>array('email3@email.net'=>'Admin'),
       'bcc'     =>array('email4@email.net'=>'Admin'),
       );
$subject = date("Ymd")." Weekly Report";
$body ='';
$body.="<div style='font-family:Arial;font-size:10pt;'>";
$body.=    "<br>"."Admin,";
$body.=    "<br>"."";
$body.=    "<br>"."Attached are the files:";
$body.=    "<br>"."* ".$file1;
$body.=    "<br>"."* ".$file2;
$body.=&nbs


相关文档:

php中计算时间差的几种方法

在php中计算时间差有时候是件麻烦的事!不过只要你掌握了日期时间函数的用法那这些也就变的简单了:  
一个简单的例子就是计算借书的天数,这需要php根据每天的日期进行计算,下面就来谈谈实现这种日期计算的几种方法:
(1) 如果有数据库就很容易了!若是MSSQL可以使用触发器!用专门计算日期差的函数datediff()便可 ......

PHP语言的一些缺陷

1. 对递归的不良支持
递归是一种函数调用自身的机制。这是一种强大的特性可以把某些复杂的东西变得很简单。有一个使用递归的例子是快速排序(quicksort)。不幸的是,PHP并不擅长递归。Zeev,一个PHP开发人员,说道:“PHP 4.0(Zend)对密集数据使用了栈方式,而不是使用堆方式。也就是说它能容忍的递归函数的数量限 ......

使用 PHP 处理 XML 配置文件


使用 PHP 处理 XML 配置文件
使用 XML 配置文件轻易地配置 PHP 应用程序和对象
级别: 中级
Vikram Vaswani, 创始人, Melonfire
2007 年 11 月 29 日
XML 为应用程序配置文件提供了一种便捷、易用的表达语言。但有时候将这些信息提取到 PHP 脚本中将会面对一个不小的挑战。这正是 XJConf for PHP 包出现的原因:它提 ......

PHP SESSION 原理


一、PHP SESSION原理
我们知道,session是在服务器端保持用户会话数据的一种方法,对应的cookie是在客户端保持用户数据。HTTP协议是一种无状态协议,服
务器响应完之后就失去了与浏览器的联系,最早,Netscape将cookie引入浏览器,使得数据可以客户端跨页面交换,那么服务器是如何记住众多用户
的会话数据呢?
首先要 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号