【 tulaoshi.com - PHP 】
很实用的一个完整email发送程序,很简单,把下列代码复制到一个空白文本页面,如index.php,运行就行了。具体实例:http://zsvalley.uhome.net/email/index.php。
以下是完整的源代码:(有任何问题请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 "请正确填写您的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 "请正确填写您好友的EMAIL地址! <A HREF='javascript:history.go(-1)'返回</A";
}else{
$message=$fname.",你好:nn你的朋友".$yname."特地来信想对向您说:n-----------------------------------n".$comments."n-----------------------------------nnn提供服务:http://zsvalley.uhome.net/email/nn◆◆◆ valley网络无界限 http://valley.coc.cc ◆◆◆n─────────────────────────n";
//email发送
mail($femail, $title, $message,"From: $yemail");
//echo nl2br($message);
$ok='no';
echo "<html<body".nl2br($message)."<BR<BR<A HREF=index.php回到发送页面</A</body</html<script language="javascript" alert("发送成功!"); </script";
}
exit();
}
?
<html
<head
<TITLE将网页推荐给好友</TITLE
<META content="text/html; charset=gb2312" http-equiv=Content-Type
<STYLE type=text/cssBODY {
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("请填写您的姓名!");
}
else if (document.frmSend.yemail.value.length<1)
{
alert("请填写您的EMAIL地址!");
&nbs