[請益] 此程式哪裡有問題?

看板Programming作者時間18年前 (2007/04/12 03:02), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
※ [本文轉錄自 PHP 看板] 作者: smileray () 看板: PHP 標題: [請益] 此程式哪裡有問題? 時間: Thu Apr 12 03:01:12 2007 想寫一個 可以寄email的程式 @@ 看書上改寫的 -----mail_online.php----- <html> <head><title>PHP_MAIL_Attach</title></head> <body> <form method=post action=mail_online_sent.php name=mailform Enctype="multipart/form-data"> 寄件人: <input type=text name=from><P> 受件者姓名:<input type=text name=whom><P> 受件者郵址:<input type=text name=to><P> 信件標題:<input type=text name=subject><P> 優先順序: <select name="Priority"> <option value="1">緊急</option> <option value="3" selected>普通</option> <option value="5">次要</option></select> <P> 信件內容:<BR> <textarea name="msg" cols="70" rows="8" maxlength="70"></textarea><P> 夾帶檔案:<BR> <input type="file" name="filename"><BR> <input type=submit value=寄信 name=submit> </form> </body> </html> -------mail_online_sent.php----- <head> <title>PHPMail</title> <meta http-equiv="Content-Type" content="text/html; charset=big5"> </head> <body bgcolor="#FFFFFF" text="#000000" link="#33CC33" vlink="#33CC33" alink="#33CC33"> <?php function encode_file($filename) { if (is_readable($filename)) { $fd = fopen($filename, "r"); $contents = fread($fd, filesize($filename)); $encoded = my_chunk_split(base64_encode($contents)); fclose($fd); } return $encoded; } function my_chunk_split($str) { $stmp = $str; $len = strlen($stmp); $out = ""; while ($len > 0) { if ($len >= 76) { $out = $out . substr($stmp, 0, 76) . "\r\n"; $stmp = substr($stmp, 76); $len = $len - 76; } else { $out = $out . $stmp . "\r\n"; $stmp = ""; $len = 0; } } return $out; } echo "郵件標題: $subject , 受件人: $to<BR>\n"; echo "<B>夾帶檔案資訊</B><BR>\n"; echo "檔案名稱:".$filename_name."<BR>\n"; echo "檔案大小:".$filename_size." bytes<BR>\n"; echo "檔案格式:".$filename_type."<HR>\n"; echo "信件已經成功寄出!"; $contents=encode_file($filename); mail("$to","$subject"," ---==attached==- Content-Type: text/plain; charset=\"US-ASCII\" Content-Transfer-Encoding: 7bit $msg ---==attached==- Content-Type: \"$filename_type\"; name=\"$filename_name\" Content-Disposition: attachment; filename=\"$filename_name\" Content-Transfer-Encoding: base64 $contents ---==attached==- ", "From: ${from} Reply-To: ${from} X-Mailer: PHP_MAIL_VEGA MIME-Version: 1.0 X-Priority: ${Priority} Content-Type: multipart/mixed; boundary=\"-==attached==-\" Content-Transfer-Encoding: 7bit"); ?> </body> </html> -- 煩請各位高手幫忙 orz 感激不盡啊 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.162.64.121 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.162.64.121
文章代碼(AID): #167J2yMG (Programming)
文章代碼(AID): #167J2yMG (Programming)