当前位置:Linux教程 - Php - 我自己借用精华区里的MIME类写了一个基本的发信小东东(1):(其实关键是SMTP的设置问题。。)

我自己借用精华区里的MIME类写了一个基本的发信小东东(1):(其实关键是SMTP的设置问题。。)

我自己借用精华区里的MIME类写了一个基本的发信小东东:

default.htm

<html>
<head>
<script language=javascript>
<!--
function cookieset(){
    d=new Date()
    d.setFullYear(2001,0,1)
    document.cookie="sendmailbox="+document.sendmailform.sendmailbox.value + ";expires=" + d.toGMTString()
    alert("设置成功!")
}

function setupdatevalue(){
    document.sendmailform.update.value=document.sendmailform.myfile.value
    if(document.sendmailform.receivemailbox.value==""){
        alert("错误!请填写收信人地址!")
        document.sendmailform.receivemailbox.focus()
        return(false)
    }
}

function readcookie(){
    cookievalue=document.cookie
    pairs=cookievalue.split(";")
    for(i=0;i<pairs.length;i++){
        pairsplit=pairs[i].split("=")
        if(pairsplit[0]=="sendmailbox") break
    }
    return(pairsplit[1])
}
//-->
</script>
<title>我的PHP发信箱</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.smallfont {  font-family: "宋体"; font-size: 9pt}
-->
</style>
</head>

<body bgcolor="#FFFFFF" onload=document.sendmailform.receivemailbox.focus()>
<p align="center">欢迎使用我的发信页面</p>
<form method="post" action="sendmail.php4" name=sendmailform enctype="multipart/form-data" onsubmit="return setupdatevalue()">
  <table width="55%" border="0" cellspacing="0" cellpadding="2" align="center" class="smallfont">
    <tr>
      <td width="33%">收信人信箱:</td>
      <td width="67%">
        <input type="text" name="receivemailbox" size="30" maxlength="40">
      </td>
    </tr>
    <tr>
      <td width="33%">发信人信箱:</td>
      <td width="67%">
        <script language=javascript>     
            document.write ("<input type='text' name='sendmailbox' size='30' maxlength='40' value='" + readcookie() + "'>")
        </script>
        <input type="button" name="setcookie" value="设为默认发信信箱" onclick=cookieset()>
      </td>
    </tr>
    <tr>
      <td width="33%">主  题:</td>
      <td width="67%">
        <input type="text" name="subject" maxlength="250" size="40">
      </td>
    </tr>
    <tr>
      <td width="33%">附  件:</td>
      <td width="67%">
        <input type="file" name="myfile">
        <input type="hidden" name=update>
      </td>
    </tr>
    <tr>
      <td width="33%" valign="top">正  文:</td>
      <td width="67%">
        <textarea name="bodytext" cols="40" rows="8"></textarea>
      </td>
    </tr>
    <tr>
      <td colspan="2" valign="top">
        <div align="center">
          <input type="submit" name="Submit" value="发送信件">
          <input type="reset" name="reset" value="重新填写">
        </div>
      </td>
    </tr>
  </table>