最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php发送邮件函数mail 教程
时间:2022-07-02 10:31:50 编辑:袖梨 来源:一聚教程网
//定义边界线
$boundary = uniqid( "" );
//生成邮件头
$header = "From: $from Content-type: multipart/mixed;
boundary="$boundary" X-Mailer:PHP X-Priority:3";
//获取附件文件的MIME类型
$mimetype = mime_content_type('test.zip')
//获取附件文件的名字
$attach = 'test.zip'
//对附件文件进行编码和切分
$fp = fopen($attach, "r");
$content = fread($fp, filesize($attach));
$content = chunk_split( base64_encode($content) );
//生成邮件主体
$body ="
--$boundary
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 8bit
$message
--$boundary
Content-Type: $mimeType; name=$filename
Content-Disposition: attachment; filename=$filename
Content-Transfer-Encoding: base64
$content
--$boundary--";
//发送邮件
mail( $to, $subject, $body, $header );
?>
转载请注明:
相关文章
- 阿里旺旺网页版版入口-阿里旺旺Web版官方网站登录入口 08-10
- 千年寻仙冲榜活动顺序详解 千年寻仙热门冲榜活动全攻略 08-10
- 战网国际服怎么找回账号-战网国际服找回账号方法 08-10
- 龙族卡塞尔之门源稚女值得培养吗 龙族卡塞尔之门源稚女培养攻略与强度分析 08-10
- 羞羞漫画登录页面在线阅读 08-10
- Java Stream Collectors功能实现做法全面指南 08-10