这是mail.php页
<?php
 /**文事名
 *著者
 *2008/01/23 に創建します
 *歴史の記録
 *機能        ユ-ザ-登録
 */?>
<?php
//移しconfig.inc.php公文書を配置 
include_once("../config.inc.php");
//移しcommonファイラ-のdb.inc.php
include_once("../common/db.inc.php");
//頭の公文書を移します/
include_once("../include/header.php");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-jp">
<title>むかえて試網に試験します</title>
<!--JS 公文書を移して校合をします-->
<script type="text/javascript" src="../js/js.php">
</script>
<!--css 公文書を移します-->
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #990000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<center>
<form name="form1"  method="post">
<table width="599" border="1">
    <tr>
    <th scope="row">人のアドレス出:</th>
    <td><input type="text" name="from" /></td>
    </tr>
    <tr>
    <th scope="row">宛て所:</th>
    <td><input type="text" name="to" /></td>
    </tr>
    <tr>
    <th scope="row">タイトル</th>
    <td><input type="text" name="subject" /></td>
    </tr>
    <tr>
    <th scope="row">内容配り:</th>
    <td><textarea rows=10 name="message"></textarea></td>
    </tr>
</table>
<input type="button" name="コミット" value="コミット" onClick="check1()">
<input type="button" name="return" onClick="history.back()" value="戻る">
</form>
</center>
<!--終わりの公文書を移します-->
<?php
include_once ("../include/footer.php")
?>
</body>
</html>
这是finishmail.php页
<?php
include_once("../config.inc.php");
?>
<?php
if(mail($_POST[to],$_POST[subject],$_POST[message],"From:$_POST[from]"))
{
echo "郵便物が発信して成功します!";
}
else
{
echo "郵便物は失敗を発信します!";
}
?>
但发送邮件老报错
Warning: mail() [function.mail]: SMTP server response: 503 valid RCPT command must precede DATA in D:\xampp\htdocs\testing\mail\finishmail.php on line 5郵便物は失敗を発信します!

解决方案 »

  1.   

    改正下代码如下
    这是mail.php页 
    <html> 
    <head> 
    <meta   http-equiv="Content-Type"   content="text/html;   charset=euc-jp"> 
    <title> むかえて試網に試験します </title>
    <?php 
    include_once("../config.inc.php"); //调用配置文件
    ?> 
    </head> 
    <body> 
    <center> 
    <form   name="form1"     method="post"> 
    <table   width="599"   border="1"> 
            <tr> 
            <th   scope="row"> 人のアドレス出: </th> 
            <td> <input   type="text"   name="from"   /> </td> 
            </tr> 
            <tr> 
            <th   scope="row"> 宛て所: </th> 
            <td> <input   type="text"   name="to"   /> </td> 
            </tr> 
            <tr> 
            <th   scope="row"> タイトル </th> 
            <td> <input   type="text"   name="subject"   /> </td> 
            </tr> 
            <tr> 
            <th   scope="row"> 内容配り: </th> 
            <td> <textarea   rows=10   name="message"> </textarea> </td> 
            </tr> 
    </table> 
    <input   type="button"   name="コミット"   value="コミット"   onClick="check1()"> 
    <input   type="button"   name="return"   onClick="history.back()"   value="戻る"> 
    </form> 
    </center> 
    </body> 
    </html> 
    ---------------------------------------
    这是finishmail.php页 
    <?php 
    include_once("../config.inc.php"); //调用配置文件
    ?> 
    <?php 
    if(mail($_POST[to],$_POST[subject],$_POST[message],"From:$_POST[from]")) 

    echo   "郵便物が発信して成功します!"; 

    else 

    echo   "郵便物は失敗を発信します!"; 

    ?>
    ---------------------------
    报错信息 
    Warning:   mail()   [function.mail]:   SMTP   server   response:   503   valid   RCPT   command   must   precede   DATA   in   D:\xampp\htdocs\testing\mail\finishmail.php   on   line   5郵便物は失敗を発信します! 请高手看看到底怎么回事,谢谢!!!
      

  2.   

    mail函数有局限性,需要配置php.ini
      

  3.   

    应该是您测试用的服务器没有邮件服务,也就是服务器不能发邮件。试一下把程序放到有SMTP服务的服务器上看看。个人网站http://www.twycn.com大家多多指教。