Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in 

解决方案 »

  1.   

    你本地的 smtp ?php.ini  配好了?
      

  2.   

    你的localhost有没有配置mail服务器啊?
      

  3.   

    我不知道.  我用的是 phpstudyAdmin  如果没有设置过 要怎么设置
      

  4.   

    Linux的mail服务器配置:
    http://tech.ddvip.com/2008-11/122776642695498.htmlWindow2003server邮件服务器配置:
    http://biz.chinabyte.com/97/2333597.shtml
      

  5.   

    <?php$to = "[email protected]";
    $subject = "My subject";
    $txt = "Hello world!";
    $headers = "From: [email protected]" . "\r\n" .
    "CC: [email protected]";mail($to,$subject,$txt,$headers);
    ?>
      

  6.   

    @ini_set("SMTP",$this->smtp["host"]);
    @ini_set("smtp_port",$this->smtp["port"]);
    @ini_set("sendmail_from",$this->smtp["from"]);
    if(@mail($toemail,$send_subject,$send_message,$additional)){
    return true;
    }else{
    return false;
    }