提交表單的內容傳到我的郵箱中,如何實現,是否用mail函數?


<form action="mailto:URL" method=POST>


<form action="mailto:yourname@host.com" method=POST type=plain/mime>
就可以了,


說錯了
以下
<form action="mailto:yourname@host.com" method=POST enctype="text/plain">


暈,這幾天大家都在發email,呵呵
這是貼第三次了,附件沒有做上,你自已改改吧,如果沒有附件的話這樣就可以用
<FORM METHOD=POST ACTION="">
發送給誰:<INPUT TYPE="text" NAME="name"><br>
標題:<INPUT TYPE="text" NAME="title"><br>
內容:<TEXTAREA NAME="content" ROWS="10" COLS="50"></TEXTAREA><br>
<INPUT TYPE="submit" value='送出新郵件'>
</FORM>
<?
if ($_POST['name'] != '') {
class mime_mail
{
var $parts;
var $to;
var $from;
var $headers;
var $subject;
var $body;
function mime_mail(){
$this->parts = array();
$this->to = "";
$this->from = "";
$this->subject = "";
$this->body = "";
$this->headers = "";
}
function add_attachment($message, $name = "", $ctype = "application/octet-stream") {
$this->parts[] = array (
"ctype" => $ctype,
"message" => $message,
"encode" => $encode,
"name" => $name
);
}
function build_message($part) {
$message = $part["message"];
$message = chunk_split(base64_encode($message));
$encoding = "base64";
return "Content-Type: ".$part["ctype"].
($part["name"]?"; name = \"".$part["name"]."\"" : "").
"Content-Transfer-Encoding: $encoding$message";
}
function build_multipart(){
$boundary = "b".md5(uniqid(time()));
$multipart = "Content-Type: multipart/mixed; boundary = $boundaryThis is a MIME encoded message.--$boundary";
for($i = sizeof($this->parts)-1; $i >= 0; $i--) {
$multipart .= "".$this->build_message($this->parts[$i])."--$boundary";
}
return $multipart.= "--";
}
function send()
{
$mime = "";
if (!empty($this->from))
$mime .= "From: ".$this->from."";
if (!empty($this->headers))
$mime .= $this->headers."";
if (!empty($this->body))
$this->add_attachment($this->body, "", "text/plain");

$mime .= "MIME-Version: 1.0".$this->build_multipart();
mail($this->to, $this->subject, "", $mime);
}
}; // end of class
//$attachment = fread(fopen("test.jpg", "r"), filesize("test.jpg"));
$mail = new mime_mail();
$mail->from = "gfqqqqpe@163.com"; //這是出處
$mail->headers = "Errors-To: gfqqqqpe@163.com";
$mail->to = $_POST['name']; //這是發到那裡
$mail->subject = $_POST['title']; //這是標題
$mail->body = $_POST['content']; //這是內容
//$mail->add_attachment("$attachment", "test.jpg", "image/jpeg"); //去掉註釋,你就以發附件
$mail->send();
print "ok,成功完成!";
}
?>
創作者介紹

ca95 台灣地誌

ca95 發表在 痞客邦 PIXNET 留言(0) 人氣()