//********Send mail
function sendmail(){
mail("to:******","****title***","$messages","From:[email protected]\nReply-To:[email protected]\nX-Mailer: php\nErrors-To:$from_email_address");
}其中$messages为你为表单内容制作的版面

解决方案 »

  1.   

    可是发生如下错误:
    Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()...
      

  2.   

    linux环境下:
    <?
    function mymail($mto,$mcc,$msubject,$mbody) 
    {  
    $from = "[email protected]"; 
    $sign = "\n";//随你便写些什么 
    $sendmailpath = "/usr/lib/sendmail";//Semdmail路径 
    $bound = "========_".uniqid("BCFMail")."==_";//分界符 
    $headers =  "MIME-Version: 1.0\n". 
                "Content-Type: multipart/mixed; boundary=\"$bound\"\n". 
                "Date: ".date("D, d M H:i:s Y ")."\n". 
                "From: $from\n". 
                "To: $mto\n". 
                "Cc: $mcc\n". 
                "Subject: $msubject\n". 
                "Status: \n". 
                "X-Status:\n". 
                "X-Mailer: MY Email Interface\n". 
                "X-Keywords:\n\n"; 
      $content="--".$bound."\n"."Content-Type:text/plain;charset=\"GB2312\"\n\n".$mbody.$sign."\n"; 
      $end = "\n"."--".$bound."--\n"; 
      $sock = popen("$sendmailpath -t -f '[email protected]'",'w'); 
      fputs($sock, $headers); 
      fputs($sock, $content); 
      fputs($sock, $end); 
      fputs($sock, ".\n"); 
      fputs($sock, "QUIT\n"); 
      pclose($sock); 
    } mymail("[email protected]", "[email protected]", "test", "test");//backhome.com.cn
    ?>
      

  3.   

    那在win xp环境下怎样搭建邮件服务器呢?
      

  4.   

    如果是Linux系统,那么系统必须打开了sendmail服务,那样执行mail()函数才又效果,因为mail函数是调用sendmail里的smtp服务来发送邮件的。如果你是windows下的话,就不要白费力气了,使用扩展类,比如PEAR里的,或者phpmailer类。推荐使用phpmailer类,只要在里面进行一下配置,包括smtp服务器,端口,用户名、密码等信息,当然,前提是要求你有邮箱,比如你有163之类的邮箱,那么就能够使用它来发送邮件了。下载地址:http://www.phpe.net/class/32.shtml