寻求邮件发送类和繁简转换类 顶一下哪位有现成的,邮我啊 [email protected] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 可带附件的代码一个小巧的发邮件的函数(可带多个任意类型附件) // Adapted from PHPLIB for PHP 3.0.7+ // By Danke Xie, Peking University function mail2( $to, $subject, $message, $from, $content_type, $attache="") { if ( !empty($from) ) $head = "From: $from\n"; if ( empty($content_type) ) $content_type = "text/plain"; if ( is_array($attache) ) { $boundary = "===" . md5(uniqid("")) . "==="; $head .= "Mime-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"". $boundary ."\"\n\nThis is a multi-part message in MIME format.\n\n"; $head .= "--" . $boundary . "\n"; $head .= "Content-Type: $content_type\n"; $head .= "\n" . $message . "\n\n"; while ( list( $key, $val ) = each($attache) ) { $fd = fopen( "./$val", "r" ) or die("unable to open file ./$val"); $contents = chunk_split(base64_encode( fread( $fd, filesize( "./$val" ) ) )); fclose( $fd ); $head .= "--" . $boundary . "\n"; $head .= "Content-Type: application/octet-stream; name=\"" . basename($val) . "\"\nContent-Transfer-Encoding: BASE64\nContent-Disposition: attachment; filename=\"" . basename($val) . "\"\n"; $head .= "\n" . $contents . "\n\n"; } $head .= "--" . $boundary . "--\n\n"; }else{ if ( !empty($content_type) ) { $head .= "Content-Type: $content_type\n"; $head .= "\n" . $message . "\n"; } } return mail( "$to", "$subject", "", $head ); } // Calling sample mail2("[email protected]","Hello",$message,"[email protected]", "",array("a.txt","b.pdf")); 好象不支持stmp的哦~~~~~~~~~`要的是可以在2000发的1 二级域名的实现? 高分求教,iis里如何实现伪静态页面 ubuntu中,使用PHP中unlink无法删除文件 PHP删除中文正则表达式 form上传,吐血再问一次。 php困扰 表单传递$name和$_POST['name']的区别 在PHP里能实现分布式程序吗? **用一个SQL语句,将数据插入到二个表中** 请高手解答关于MYSQL数据库问题 各位,小弟我很受伤!因此有忙请大家帮.谢谢 为什么我把big5转换gb后存到mysql结果很多字变成了UTF-8码
一个小巧的发邮件的函数(可带多个任意类型附件)
// Adapted from PHPLIB for PHP 3.0.7+
// By Danke Xie, Peking University function mail2( $to, $subject, $message, $from, $content_type, $attache="")
{
if ( !empty($from) ) $head = "From: $from\n";
if ( empty($content_type) ) $content_type = "text/plain"; if ( is_array($attache) ) {
$boundary = "===" . md5(uniqid("")) . "===";
$head .= "Mime-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"". $boundary ."\"\n\nThis is a multi-part message in MIME format.\n\n";
$head .= "--" . $boundary . "\n";
$head .= "Content-Type: $content_type\n";
$head .= "\n" . $message . "\n\n"; while ( list( $key, $val ) = each($attache) ) {
$fd = fopen( "./$val", "r" ) or die("unable to open file ./$val");
$contents = chunk_split(base64_encode( fread( $fd, filesize( "./$val" ) ) ));
fclose( $fd );
$head .= "--" . $boundary . "\n";
$head .= "Content-Type: application/octet-stream; name=\"" . basename($val) . "\"\nContent-Transfer-Encoding: BASE64\nContent-Disposition: attachment; filename=\"" . basename($val) . "\"\n";
$head .= "\n" . $contents . "\n\n";
}
$head .= "--" . $boundary . "--\n\n";
}else{
if ( !empty($content_type) ) {
$head .= "Content-Type: $content_type\n";
$head .= "\n" . $message . "\n";
}
}
return mail( "$to", "$subject", "", $head );
} // Calling sample
mail2("[email protected]","Hello",$message,"[email protected]",
"",array("a.txt","b.pdf"));