很實(shí)用的一個(gè)完整email發(fā)送程序
發(fā)表時(shí)間:2024-06-13 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]很實(shí)用的一個(gè)完整email發(fā)送程序,很簡(jiǎn)單,把下列代碼復(fù)制到一個(gè)空白文本頁面,如index.php,運(yùn)行就行了。具體實(shí)例:http://zsvalley.uhome.net/email/index.php。 以下是完整的源代碼:(有任何問題請(qǐng)email:zsvalley@cmmail.com) &...
很實(shí)用的一個(gè)完整email發(fā)送程序,很簡(jiǎn)單,把下列代碼復(fù)制到一個(gè)空白文本頁面,如index.php,運(yùn)行就行了。具體實(shí)例:http://zsvalley.uhome.net/email/index.php。
以下是完整的源代碼:(有任何問題請(qǐng)email:zsvalley@cmmail.com)
<?
if ($ok=='yes'){
// SetCookie("yname", $yname);
// SetCookie("yemail", $yemail);
if (!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$yemail)){
echo "請(qǐng)正確填寫您的EMAIL地址! <A HREF='
javascript:history.go(-1)'>返回</A>";
}elseif(!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$femail)){
echo "請(qǐng)正確填寫您好友的EMAIL地址! <A HREF='
javascript:history.go(-1)'>返回</A>";
}else{
$message=$fname.",你好:nn你的朋友".$yname."特地來信想對(duì)向您說:n-----------------------------------n".$comments."n-----------------------------------nnn提供服務(wù):http://zsvalley.uhome.net/email/nn◆◆◆ valley網(wǎng)絡(luò)無界限 http://valley.coc.cc ◆◆◆n─────────────────────────n";
//email發(fā)送
mail($femail, $title, $message,"From: $yemail");
//echo nl2br($message);
$ok='no';
echo "<html><body>".nl2br($message)."<BR><BR><A HREF=index.php>回到發(fā)送頁面</A></body></html><script language="javascript"> alert("發(fā)送成功!"); </script>";
}
exit();
}
?>
<html>
<head>
<TITLE>將網(wǎng)頁推薦給好友</TITLE>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<STYLE type=text/css>BODY {
FONT-SIZE: 14px; LINE-HEIGHT: 18px
}
TD {
FONT-SIZE: 14px; LINE-HEIGHT: 18px
}
.st1 {
BACKGROUND-COLOR: #ffcc66; BORDER-BOTTOM: #ffcc66 1px solid; BORDER-LEFT: #ffcc66 1px solid; BORDER-RIGHT: #ffcc66 1px solid; BORDER-TOP: #ffcc66 1px solid; COLOR: #aa0000; FONT-SIZE: 9pt
}
.st2 {
BACKGROUND-COLOR: #ffcc66; BORDER-BOTTOM: #ec9f00 1px solid; BORDER-LEFT: #ffffff 1px solid; BORDER-RIGHT: #ec9f00 1px solid; BORDER-TOP: #ffffff 1px solid; COLOR: #aa0000; FONT-SIZE: 9pt; HEIGHT: 20px; WIDTH: 60px
}
</STYLE>
<script language=JavaScript runat=Server>
function check()
{
if (document.frmSend.yname.value.length<1)
{
alert("請(qǐng)?zhí)顚懩男彰?quot;);
}
else if (document.frmSend.yemail.value.length<1)
{
alert("請(qǐng)?zhí)顚懩腅MAIL地址!");
}
else if (document.frmSend.fname.value.length<1)
{
alert("請(qǐng)?zhí)顚懩糜训男彰?quot;);
}
else if (document.frmSend.femail.value.length<1)
{
alert("請(qǐng)?zhí)顚懩糜训腅MAIL地址!");
}
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(){ //獲取父頁的標(biāo)題
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系統(tǒng)!</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>主題:</td><td width="40%" height="22" bgcolor=#fdf4db>
<input class=st1 name="title" size="20" >
</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>您的姓名:</td><td width="60%" height="22" bgcolor=#fdf4db><input class=st1 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>郵件地址:</td><td width="60%" height="22" bgcolor=#fdf4db><input class=st1 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>朋友的姓名:</td><td width="60%" height="22" bgcolor=#fdf4db><input class=st1 name="fname" size="20" value=></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>郵件地址:</td><td width=60%height="22" bgcolor=#fdf4db><input class=st1 name="femail" size="20" value=></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">您想說的話:</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="發(fā)送" NAME="send" ONCLICK=check()></div></td></tr> </table></form></center><BR><!--#51Net -->
</body>
</html>
【本文版權(quán)歸作者與奧索網(wǎng)共同擁有,如需轉(zhuǎn)載,請(qǐng)注明作者及出處】