Home >Backend Development >PHP Tutorial >A very practical and complete email sending program_PHP tutorial

A very practical and complete email sending program_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:02:411170browse

A very practical and complete email sending program. It is very simple. Just copy the following code to a blank text page, such as index.php, and run it. Specific example: http://zsvalley.uhome.net/email/index.php.
The following is the complete source code: (If you have any questions, please 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 "Please be correct Fill in your EMAIL address! Return"; -9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$",$femail)){

echo "Please fill in your friend's EMAIL address correctly! Return";

   }else{

                                                                                                                                                               $message=$fname.",Hello:nnYour friend ".$yname." I wrote a special letter to say to you:n----------------- ------------------n".$comments."n------------------------ ----------nnn provides services: http://zsvalley.uhome.net/email/nn◆◆◆ valley network without boundaries http://valley.coc.cc ◆◆◆n─── ──────────────────────n";

//Send email
mail($femail, $title, $message," From: $yemail");
//echo nl2br($message);
      $ok='no'; "

Back to sending page";

  }
exit();
}
?> ;
Recommend webpage to friends


< ;script language=JavaScript runat=Server>
function check()
{
if (document.frmSend.yname.value.length<1)
{
alert("Please fill in your name! ");
}
else if (document.frmSend.yemail.value.length<1)
{
alert("Please fill in your EMAIL address! ");
}
else if (document.frmSend.fname.value.length<1)
{
alert("Please fill in your friend’s name!");
}
else if (document.frmSend.femail.value.length<1)
{
alert("Please fill in your friend’s EMAIL address!");
}
else document.frmSend.submit();
}

//=================== ==DRAGON CODE================================
function forHtmlSpecialChars(str){ //Change the HTML Special characters are replaced with codes
str=strReplace(str,"&","&");
str=strReplace(str,""",""");
str=strReplace(str, "<","<");
str=strReplace(str,">",">");
str=strReplace(str,"%20"," ");
return str;
}

function strReplace(str,str1,str2){ //Replace all str1 in str with str2
while(str.search(str1)>- 1)
str=str.replace(str1,str2);
return str;
}

function getParentTitle(){ //Get the title of the parent page
str=location .href;
str=str.substring(str.indexOf("parentTitle"),str.indexOf("parentTitleEnd"));
str=str.substring(12,str.length);
return str;
}
//======================================== ================




Fast email system!

  
  
  
  
  
  
  
  
  
  
  
  
主题:  

您的姓名:>
邮件地址:>
朋友的姓名:
邮件地址:
您想说的话:
VALUE="发送" NAME="send" ONCLICK=check()>





[The copyright of this article is jointly owned by the author and Aosuo.com. If you need to reprint, please indicate the author and source]

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/316454.htmlTechArticleA very practical and complete email sending program, very simple, copy the following code to a blank text page, such as index .php, just run it. Specific example: http://zsvalley.uhome.net/...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn