提交表单的内容传到我的邮箱中,如何实现,是否用mail函数? <form action="mailto:URL" method=POST> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <form action="mailto:[email protected]" method=POST type=plain/mime>就可以了, 说错了以下<form action="mailto:[email protected]" 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"]."\"" : ""). "\nContent-Transfer-Encoding: $encoding\n\n$message\n"; } function build_multipart(){ $boundary = "b".md5(uniqid(time())); $multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary"; for($i = sizeof($this->parts)-1; $i >= 0; $i--) { $multipart .= "\n".$this->build_message($this->parts[$i])."--$boundary"; } return $multipart.= "--\n"; } function send() { $mime = ""; if (!empty($this->from)) $mime .= "From: ".$this->from."\n"; if (!empty($this->headers)) $mime .= $this->headers."\n"; if (!empty($this->body)) $this->add_attachment($this->body, "", "text/plain"); $mime .= "MIME-Version: 1.0\n".$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 = "[email protected]"; //这是出处 $mail->headers = "Errors-To: [email protected]"; $mail->to = $_POST['name']; //这是发到哪里 $mail->subject = $_POST['title']; //这是标题 $mail->body = $_POST['content']; //这是内容 //$mail->add_attachment("$attachment", "test.jpg", "image/jpeg"); //去掉注释,你就以发附件 $mail->send(); print "ok,成功完成!";}?> 新手求问如何学好php php做了无限循环,就是smarty 模板里在怎么调用。 SQL的安装及与PHP的链接 关于php读取文本文件的问题 急急急!php连接sql 2005失败 有分拿还可以找工作,北京高薪聘请PHP程序员。你准备好了吗? smatrtemplet 的问题? 显示时间的问题 编写软件方案书的问题,请大家帮帮忙 php中怎样在子类里访问超类构造函数,(不是用parent调用超类的构造函数名),就是如java的super(), 为什么我在用ftp_connect()的时候,出现没有定意这个函数的错误? PHP安装要什么条件?
<form action="mailto:[email protected]" method=POST enctype="text/plain">
这是贴第三次了,附件没有做上,你自已改改吧,如果没有附件的话这样就可以用
<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"]."\"" : "").
"\nContent-Transfer-Encoding: $encoding\n\n$message\n";
} function build_multipart(){
$boundary = "b".md5(uniqid(time()));
$multipart = "Content-Type: multipart/mixed; boundary = $boundary\n\nThis is a MIME encoded message.\n\n--$boundary"; for($i = sizeof($this->parts)-1; $i >= 0; $i--) {
$multipart .= "\n".$this->build_message($this->parts[$i])."--$boundary";
}
return $multipart.= "--\n";
}
function send()
{
$mime = "";
if (!empty($this->from))
$mime .= "From: ".$this->from."\n";
if (!empty($this->headers))
$mime .= $this->headers."\n"; if (!empty($this->body))
$this->add_attachment($this->body, "", "text/plain");
$mime .= "MIME-Version: 1.0\n".$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 = "[email protected]"; //这是出处
$mail->headers = "Errors-To: [email protected]"; $mail->to = $_POST['name']; //这是发到哪里
$mail->subject = $_POST['title']; //这是标题
$mail->body = $_POST['content']; //这是内容
//$mail->add_attachment("$attachment", "test.jpg", "image/jpeg"); //去掉注释,你就以发附件
$mail->send();
print "ok,成功完成!";
}
?>