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
相关文档:
1. 对递归的不良支持
递归是一种函数调用自身的机制。这是一种强大的特性可以把某些复杂的东西变得很简单。有一个使用递归的例子是快速排序(quicksort)。不幸的是,PHP并不擅长递归。Zeev,一个PHP开发人员,说道:“PHP 4.0(Zend)对密集数据使用了栈方式,而不是使用堆方式。也就是说它能容忍的递归函数的数量限 ......
用 PHP 读取和编写 XML DOM
使用 DOM 库、SAX 解析器和正则表达式
文档选项
打印本页
将此页作为电子邮件发送
级别: 中级
Jack Herrington (jack_d_herrington@codegeneration.net), 高级软件工程师, "Code Generation Network"
2006 年 2 月 06 日
有许多技术可用于用 PHP 读取和编写 XML。本文提供了三种 ......
使用 PHP 处理 XML 配置文件
使用 XML 配置文件轻易地配置 PHP 应用程序和对象
级别: 中级
Vikram Vaswani, 创始人, Melonfire
2007 年 11 月 29 日
XML 为应用程序配置文件提供了一种便捷、易用的表达语言。但有时候将这些信息提取到 PHP 脚本中将会面对一个不小的挑战。这正是 XJConf for PHP 包出现的原因:它提 ......
JAVA文件读写必须要注意编码问题
java的文件写
直接使用FileWriter即可,第二个参数为追加写入,默认是覆盖写。写完必须close才会保存写好的内容。
默认情况如果没有会新建一个文件
FileWriter fw = null;
try {
fw = new FileWriter("/data/updatetime.dat", true); // true追加写入
fw.append ......