歡迎您光臨本站 註冊首頁

一個簡單的郵件發送系統原代碼

←手機掃碼閱讀     火星人 @ 2014-03-05 , reply:0

一個簡單的郵件發送系統原代碼

大家好,我寫了一個簡單的郵件發送的頁面,現在發送到伺服器上以後,不能使用,但是沒有表示出現什麼錯誤,請大家看看問題出在哪裡?我發送上去以後的頁面是http;//www.hta-services.com/email.php 下面是原代碼:
<?php
if ($mode=="submit") {
if ($enable_html !="on") {
$mail_body= htmlspecialchars ($mail_body);
}
$headers .="MIME-Version:1.0 \n";
$headers .="Content-type:text/html;charset=iso-8859-1 \n";
$headers .="from:$mail_from\r\nCc:$mail_cc\r\nBcc:$mail_bcc";

if (mail ($mail_to, $mail_subject,$mail_body,$headers)) {
print ("<h1><font color=\"#004000\">The e-mail was sent successfully!</font></h1>");
} else {
print ("<h1><font color=\"#880000\">An error occurred while sending the e-mail!</font></h1>");
}
exit;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>HTA-services.nl is the best!</title>
<script language="javascript">
function DoSubmit ()
{
if (document.form.mail_from.value == "") {
alert ("You forgot to enter the 'from' field.");
document.form.mail_from.focus ();
return "";
}
if (document.form.mail_to.value == "") {
alert ("You forgot to enter the 'to' field.");
document.form.mail_to.focus ();
return "";
}
if (document.form.mail_subject.value == "") {
alert ("You forgot to enter the 'subject' field.");
document.form.mail_subject.focus ();
return "";
}
if (document.form.mail_body.value == "") {
alert ("You forgot to enter the 'body' field.");
document.form.mail_body.focus ();
return "";
}
</script>
<style type="text/css">
<!--
.STYLE6 {
        font-family: "Times New Roman";
        font-size: 12px;
        color: #880000;
}
.STYLE12 {
        font-size: 12px;
        color: #6666FF;
}
.STYLE16 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #6666FF; }
.STYLE18 {font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #6666FF; }
.STYLE19 {color: #880000}
-->
</style>
</head>

<body>
<form action ="<?php print ($PHP_SELF); ?>" method="post" name="form">
  <table width="62%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
      <td width="24%" height="28" bgcolor="#E0DFE3"><div align="right" class="STYLE16">From:&nbsp;&nbsp;</div></td>
      <td width="76%" bgcolor="#E0DFE3"><span class="STYLE18">
        <label>
        <input type="text" name="mail_from">
        <span class="STYLE19">*</span></label>
      </span></td>
    </tr>
    <tr>
      <td height="28" bgcolor="#E0DFE3"><div align="right" class="STYLE16">To:&nbsp;&nbsp;</div></td>
      <td bgcolor="#E0DFE3"><span class="STYLE18">
        <input type="text" name="mail_to">
      <span class="STYLE19">*</span></span></td>
    </tr>
    <tr>
      <td height="28" bgcolor="#E0DFE3"><div align="right" class="STYLE16">Cc:&nbsp;&nbsp;</div></td>
      <td bgcolor="#E0DFE3"><input name="mail_cc" type="text"></td>
    </tr>
    <tr>
      <td height="28" bgcolor="#E0DFE3"><div align="right" class="STYLE16">Bcc:&nbsp;&nbsp;</div></td>
      <td bgcolor="#E0DFE3"><input name="mail_bcc" type="text"></td>
    </tr>
    <tr>
      <td height="28" bgcolor="#E0DFE3"><div align="right" class="STYLE16">Subject:&nbsp;&nbsp;</div></td>
      <td bgcolor="#E0DFE3"><span class="STYLE18">
        <input type="text" name="mail_subject">
        <span class="STYLE19">      *</span></span></td>
    </tr>
    <tr>
      <td height="28" bgcolor="#E0DFE3"><div align="right" class="STYLE16">Body:&nbsp;&nbsp;</div></td>
      <td bgcolor="#E0DFE3"><span class="STYLE12" style="font-family: Arial, Helvetica, sans-serif">
        <textarea name="mail_body" cols="45" rows="8" style="border:1px double rgb(187,185,185);font:9pt"></textarea>
        <span class="STYLE19">*</span></span></td>
    </tr>
    <tr>
      <td height="28" bgcolor="#E0DFE3">&nbsp;</td>
      <td bgcolor="#E0DFE3"><label>
        <input type="checkbox" name="enable_html" value="checkbox">
      </label>
        <span class="STYLE6">enable HTML in this message.</span> </td>
    </tr>
    <tr>
      <td height="28" colspan="2" bgcolor="#E0DFE3"><label>
        <div align="center">
          <input type="submit" name="Submit" value="Send e-mail">
          </div>
      </label></td>
    </tr>
  </table>
</form>
</body>
</html>
《解決方案》

問題解決了,謝謝大家的光顧

[火星人 ] 一個簡單的郵件發送系統原代碼已經有637次圍觀

http://coctec.com/docs/service/show-post-45163.html