请大家帮我看看下面的代码为什么无法实现?
文件名是index.php,没有编译错误,但是无法实现发邮件的功能,请各位帮帮忙,谢谢!
<?
$ok=$HTTP_POST_VARS["ok"] ;
if ($ok=='yes')
{
$message="OK!";
mail($femail, $title, $message,"From: $yemail");
$ok='no';
echo "<html><body>".nl2br($message)."<BR><BR><A HREF=index.php>back to the send page</A></body></html><script language='javascript'> alert('Sending successfully!'); </script>";
exit();
}
?>
<html>
<head>
<TITLE>mail</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<script language=JavaScript runat=Server>
function check()
{
if (document.frmSend.yname.value.length<1)
{
alert("please input your name!");
}
else if (document.frmSend.yemail.value.length<1)
{
alert("please input your address!");
}
else if (document.frmSend.fname.value.length<1)
{
alert("please input your friend's name!");
}
else if (document.frmSend.femail.value.length<1)
{
alert("please input your friend's address!");
}
else document.frmSend.submit();
}
//=====================DRAGON CODE===============================
function forHtmlSpecialChars(str){ //将HTML中的特殊字符替换成代码
str=strReplace(str,"&","&");
str=strReplace(str,"\"",""");
str=strReplace(str,"<","<");
str=strReplace(str,">",">");
str=strReplace(str,"%20"," ");
return str;
}
function strReplace(str,str1,str2){ //将str中的所有str1替换城str2
while(str.search(str1)>-1)
str=str.replace(str1,str2);
return str;
}
function getParentTitle(){ //获取父页的标题
str=location.href;
str=str.substring(str.indexOf("parentTitle"),str.indexOf("parentTitleEnd"));
str=str.substring(12,str.length);
return str;
}
//======================================================
</script>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
</head>
<body bgColor=white link=#ec9f00 text=#aa0000>
<center> <H3>email system</H3>
<FORM name=frmSend ACTION="index.php" METHOD=POST onsubmit="return check();">
<INPUT TYPE="hidden" NAME="referer" value="<?echo $referer;?>">
<INPUT TYPE="hidden" NAME="ok" VALUE="yes">
<INPUT TYPE="hidden" NAME="title" VALUE="<?echo $parentTitle;?>">
<table bgColor=#e99b0a border=0 cellPadding=2 cellSpacing=1>
<tr>
<td width="40%" height="22" bgColor=#fdf4db>header:</td>
<td width="40%" height="22" bgcolor=#fdf4db>
<input type="text" name="title" size="20" value="<?echo $title;?>"></td>
</tr>
<tr>
<td width="40%" height="10" bgColor=#fdf4db></td>
<td width="60%" height="10" bgcolor="#fdf4db"></td>
</tr>
<tr>
<td width="40%" height="22" bgColor=#fdf4db>your name:</td>
<td width="60%" height="22" bgcolor=#fdf4db>
<input type="text" name="yname" size="20" value="<?echo $yname;?>"></td>
</tr>
<tr>
<td width="40%" height="10" bgcolor=#fdf4db></td>
<td width="60%" height="10" bgcolor=#fdf4db></td>
</tr>
<tr>
<td width="40%" height="22" bgcolor=#fdf4db>address:</td>
<td width="60%" height="22" bgcolor=#fdf4db>
<input type="text" name="yemail" size="20" value="<?echo $yemail;?>"></td>
</tr>
<tr>
<td width="40%" height="10" bgcolor=#fdf4db></td>
<td width="60%" height="10" bgcolor=#fdf4db></td>
</tr>
<tr>
<td width="40%" height="22" bgcolor=#fdf4db>friend's name:</td>
<td width="60%" height="22" bgcolor=#fdf4db>
<input type="text" name="fname" size="20" value="<?echo $fname;?>"></td>
</tr>
<tr>
<td width="40%" height="10" bgcolor=#fdf4db></td>
<td width="60%" height="10" bgcolor=#fdf4db></td>
</tr>
<tr>
<td width="40%" height="22" bgcolor=#fdf4db>address:</td>
<td width="60%" height="22" bgcolor=#fdf4db>
<input type="text" name="femail" size="20" value="<?echo $femail;?>"></td>
</tr>
<tr>
<td width="40%" height="10" bgcolor=#fdf4db></td>
<td width="60%" height="10" bgcolor=#fdf4db></td>
</tr>
<tr>
<td width="100%" height="22" bgcolor=#fdf4db colspan="2">content:</td>
</tr>
<tr>
<td width="100%" bgcolor=#fdf4db height="10" colspan="2">
<textarea class=st1 rows="6" name="comments" cols="36"></textarea>
</td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor=#fdf4db>
<div align="center">
<INPUT TYPE=button CLASS=st2 VALUE="send" NAME="send" ONCLICK="check()">
</div>
</td>
</tr>
</table>
</form>
</center>
<BR>
</body>
</html>
问题点数:0、回复次数:5Top
1 楼DFlyingchen(弱水三千)回复于 2003-09-03 11:05:14 得分 0
php.ini中关于SMTP的设置正确了么?Top
2 楼sakulomatata()回复于 2003-09-03 11:21:29 得分 0
具体需要设置什么,如何设置?Top
3 楼mattyou()回复于 2003-09-03 11:33:20 得分 0
[mail function]
; For Win32 only.
SMTP = 邮件服务器Top
4 楼sakulomatata()回复于 2003-09-03 13:53:45 得分 0
在linux上具体如何配置mail服务器?Top
5 楼feel8(Max.H)回复于 2003-09-05 10:16:32 得分 0
sendmail_path =
?没在linux下试过。Top




