[转载]Support页面中发送信息到邮箱的表单代码
表单HTML代码:support.htmChinese Forum on Shareware !/F6rtt5k,G
1TpF `$erO
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">www.cnsw.org&Upj.Rj
<html>www.cnsw.orgyY"T~7|}
<head>中国共享软件联盟,CNSW,Shareware,developing,marketing,共享软件,市场,海外k QR?/hwxj
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">www.cnsw.org6|;S7S#P2H#C%w
<title>Support</title>
<script language=JavaScript src="mail.js"></script>
</head>
中国共享软件联盟论坛iri!\L%ld+ni3C
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">],JI+Gz;{A4?
<table width="600" border="0" cellpadding="6" cellspacing="1" bgcolor="#FFFFFF">
<form id="form1" method="post" action="http://www.yourwebsite.com/support.php" onsubmit="return Form_Validator(this);" name="theForm">Chinese Forum on Shareware !7~c&tvbP[7r@
<tr>
<td align="right">Your Name:</td>
<td><input name="name" type="text" id="name"></td> dTq.p(EF%X
</tr>
<tr>
<td align="right">Your Email:</td>
<td><input name="email" type="text" id="email"></td>;d9Z#uQSm$}qh]0@E
Hh
</tr>Chinese Forum on Shareware !fv'O'~*U+~3j
<tr>
<td align="right">Your Message:</td>中国共享软件联盟论坛dxkBR
<td><textarea name="yourmessage" cols="40" rows="10" id="yourmessage"></textarea></td> Pr/v
^#FG"Xt
</tr>
<tr> 0J+H\4`.`j
<td align="right"> </td>
<td><input type="submit" name="Submit" value="Submit"> www.cnsw.org#s X4c;|aL$_#F
<input type="reset" name="Reset" value="Reset"></td>Chinese Forum on Shareware !b2V9@F5O}l?
</tr>
</form>
</table>
</body>
</html>y
p j&xs9Y,|n
表单信息验证代码:mail.js4T8e-M$~(GT,e],{
<!--
function Form_Validator(theForm)中国共享软件联盟论坛ps-o(x
T0f
{
if (theForm.name.value == "")中国共享软件联盟论坛+a6j0K0~-HR
{中国共享软件联盟论坛6}%N9Fi)`r9rdh
alert("请填写 \"your name\"");中国共享软件联盟,CNSW,Shareware,developing,marketing,共享软件,市场,海外@ W'U&q(nF
theForm.name.focus();
return false;www.cnsw.org+y'i.Kb'Z5{r
}
Chinese Forum on Shareware !M_Y2in
Y
if (theForm.email.value == "")中国共享软件联盟论坛5Mb b2~C
{
alert("请填写 \"Your Email\"");
theForm.email.focus();
return false;%p9wJ$\ka;t-w`
}中国共享软件联盟,CNSW,Shareware,developing,marketing,共享软件,市场,海外5P)Wy8aX-~6W
www.cnsw.orgQi7x$_ T
if (theForm.yourmessage.value == "")
{;YF2dO7{;U;gs
alert("请填写 \"Your Message\"");www.cnsw.orgPs9@1m.qd
theForm.yourmessage.focus();中国共享软件联盟,CNSW,Shareware,developing,marketing,共享软件,市场,海外6p'V8A'{|3D(@x}
return false;
}TwZpg N
return (true);U-r%X S*@&A2eM"J+n
}
yU*[IpE!b+e
//-->
中国共享软件联盟,CNSW,Shareware,developing,marketing,共享软件,市场,海外_v]3p/s|w
发送邮件PHP代码:support.php
s/[ Im
F
}a
<?php*g4h;\0P\H"I&l7U
$NAME = $_POST["name"];
$EMAIL = $_POST["email"];
$MESSAGE = $_POST["yourmessage"];
?>\1YW#p
u+amjx4I
<?php中国共享软件联盟论坛 fH-Oy T2I~
set_time_limit("0");中国共享软件联盟,CNSW,Shareware,developing,marketing,共享软件,市场,海外WfWy:okx
function result() {www.cnsw.org q^t$t_&~"[dXu
global $socket;
$result = fgets($socket);
}www.cnsw.org-S~,JAW
$socket = fsockopen("yourwebsite.com","25");
set_socket_blocking($socket,true);
fputs($socket,"HELO try \n");www.cnsw.orgx,T _r7C\#G_
fputs($socket,"AUTH LOGIN \n");
fputs($socket,base64_encode("webmaster@yourwebsite.com")."\n");k7Pt o0K/o$SPu o
fputs($socket,base64_encode("yourpassword")."\n");
fputs($socket,"MAIL FROM: webmaster@yourwebsite.com \n");www.cnsw.orgX'Z2KU7Z`A7Jl
fputs($socket,"RCPT TO: support@yourwebsite.com \n");
fputs($socket,"DATA\n");
$send = "From: webmaster@yourwebsite.com\n"."To: support@yourwebsite.com"."\nSubject:$NAME\n\nName: $NAME; E-mail: $EMAIL; Message: $MESSAGE\n.\n";
fputs($socket,$send);中国共享软件联盟论坛}W8DIhb"d
result();
fclosel%[t:_``1pn e3R
($socket);
?>中国共享软件联盟,CNSW,Shareware,developing,marketing,共享软件,市场,海外ET`{,H[6YC
<?php
header("Location: http://www.yourwebsite.com/support.htm");
exit;www.cnsw.org[ N)F@nO:M"c3Gh1H
?>;S#m6H7B$O{4Q
h
就这些,应该能看懂吧?
其中,webmaster@yourwebsite.com是你用来发信的,yourpassword是webmaster@yourwebsite.com的密码;support@yourwebsite.com是你用来收信的。