好了下面我们来看看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 );
- ?>
|