php發送郵件函數mail 教程
來源:程序員人生 發布時間:2014-04-21 15:24:06 閱讀次數:3026次
好了下面我們來看看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 );
- ?>
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈