错误信息:
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for [email protected] in D:\WWWROOT\index.php on line 16服务器环境:
iis 5.1
php5 isapi页面代码:<?php  $to      = "[email protected]";
  $subject = "测试成功!";
  $message = "测试成功!";
  $headers = "From:[email protected]";  mail($to, $subject, $message, $headers);?>
PHP.ini:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25; For Win32 only.
;sendmail_from = [email protected]配置:
[访问控制]
√ 匿名访问
× 基本身份验证
× 集成 Window 身份验证[中继限制]
仅以下列表
允许 127.0.0.0
允许所有通过身份验证的计算机进行中继...[域]
域名:localhost  本地(默认)现在实在不知道问题出在哪里了,请高手赐教。另外别给我推荐别的什么类或方法,我现在想针对现有环境解决问题。另另外从别的地方贴的长篇大论就别来了,这个应该是服务器权限设置问题。

解决方案 »

  1.   

       根据错误提示好象问题应该出在QQ那里,而不是你的服务器上。
    SMTP server response:550 5.7.1 Unable to relay for [email protected] 
       QQ那里不能对你的请求做出回应!不单QQ,只要大一点的邮件服务器商,都会做限制,过滤垃圾邮件,即使你的信息不是,但是由于你是个人的,并没有在QQ或163的可信赖的范围内,所以它完全有可能把你发的信息当成垃圾邮件来对待!如果你用QQ自己的发信服务器(用户名和密码)配合PHPMAIL类或大服务商,或通过认证的邮件服务器去发应该就不会出现这种情况了!
      

  2.   

    sendmail_from = [email protected]需要有实际的域名,而非example.com这样的,因为对方的服务器会反向解析你的邮箱地址的!如果你不具备有真实的邮箱(域名、服务器)的话,那么就只能有在线smtp的方式!
      

  3.   

    确实是127.0.0.1写成127.0.0.0了,改完之后就在没有报过错,不过一下午莫名奇妙的发不出去,然后晚上就突然能发了哈~下边是我的程序<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>邮件群发</title>
    <script type="text/javascript" src="../plugins/kindeditor/kindeditor.js"></script>
    <script type="text/javascript">
      <!--
      KE.show({
                id : "content",
        resizeMode : 0
      });
      //-->
    </script>
    </head><body>
    <form action="index.php" method="post" enctype="multipart/form-data">
    <table align="center">
      <tr>
        <td width="700" height="50" align="left" colspan="2">
          <span style="color:red;">
    <?php  $file_name = $_FILES["file"]["name"];
      $file_ntmp = $_FILES["file"]["tmp_name"];
      $file_type = $_FILES["file"]["type"];
      $file_size = $_FILES["file"]["size"];  if(!$_FILES["file"]["error"] && $file_type == "text/plain") {
        move_uploaded_file($file_ntmp, "address.txt");
      }  if(file_exists("address.txt")) {
        ini_set("SMTP", "localhost");    $mail_title   = $_POST["title"];
        $mail_content = $_POST["content"];
        $mail_address = fopen("address.txt", "r");
        $mail_headers  = "MIME-Version: 1.0"                      . "\r\n"; 
        $mail_headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
        $mail_headers .= "Reply-To: [email protected]"           . "\r\n"; 
        $mail_headers .= "From: [email protected]"               . "\r\n";     if($mail_title != "" && $mail_content != "") {
          while(!feof($mail_address)) {
            mail(
              fgets($mail_address),
              $mail_title,
              $mail_content,
              $mail_headers
            );
          }
          echo "发送成功";
        }    fclose($mail_address);
      }?>      </span>
        </td>
      </tr>
      <tr>
        <td width="100" height="30" align="right">邮箱列表:</td>
        <td width="600" height="30" align="left" ><input id="file" name="file" type="file" style="width:600px; height:27px;" /></td>
      </tr>
      <tr>
        <td width="100" height="30" align="right">邮件标题:</td>
        <td width="600" height="30" align="left" ><input id="title" name="title" type="text" style="width:600px; height:20px;" value="<?php echo $mail_title ?>" /></td>
      </tr>
      <tr>
        <td width="100" height="300" align="right">邮件内容:</td>
        <td width="600" height="300" align="left" ><textarea id="content" name="content" style="width:600px; height:300px;"><?php echo $mail_content ?></textarea></td>
      </tr>
      <tr>
        <td width="100" height="30"></td>
        <td width="600" height="30"><input type="submit" value="提交" /></td>
      </tr>
    </table>
    </form>
    </body>
    </html>