php发送邮件函数mail 教程
来源:程序员人生 发布时间:2014-04-21 15:24:06 阅读次数:2812次
好了下面我们来看看php发送邮件函数mail 教程,如果要使用mail函数能够正常使用我们还得配置php.ini里面的参数哦.
- <?php
-
- $boundary = uniqid( "" );
-
- $header = "From: $fromnContent-type: multipart/mixed;
- boundary="$boundary"nX-Mailer:PHPnX-Priority:3";
-
- $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 );
- ?>
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠