php默认不支持mail()函数吗?怎么会出现下面的错误提示? 你尝试改用sendmail_path=/usr/sbin/sendmail -t -i 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 提供空间的服务商一般不提供.php安装后,应该也不是默认安装的. 不要用mail函数发mail了!!用pear库里的类或者socket发吧!! 这个可以吗?我在网上找的.<?phpclass send_mail{var $lastmessage; //记录最后返回的响应信息 var $lastact; //最后的动作,字符串形式 var $welcome; //用在HELO后面,欢迎用户 var $debug; //是否显示调试信息 var $smtp; //smtp服务器 var $port; //smtp端口号 var $fp; //socket句柄 function send_mail($smtp, $welcome="", $debug=false) { if(empty($smtp)) die("SMTP cannt be NULL!"); $this->smtp=$smtp; if(empty($welcome)) { $this->welcome=gethostbyaddr("61.243.232.26"); } else $this->welcome=$welcome; $this->debug=$debug; $this->lastmessage=""; $this->lastact=""; $this->port="25"; } function show_debug($message, $inout) { if ($this->debug) { if($inout=="in") //响应信息 { $m='<< '; } else $m='>> '; if(!ereg("\n$", $message)) $message .= "<br>"; $message=nl2br($message); echo "<font color=#999999>${m}${message}</font>"; } } function do_command($command, $code) { $this->lastact=$command; $this->show_debug($this->lastact, "out"); fputs ( $this->fp, $this->lastact ); $this->lastmessage = fgets ( $this->fp, 512 ); $this->show_debug($this->lastmessage, "in"); if(!ereg("^$code", $this->lastmessage)) { return false; } else return true; } function send( $to,$from,$subject,$message) { //连接服务器 $this->lastact="connect"; $this->show_debug("Connect to SMTP server : ".$this->smtp, "out"); $this->fp = fsockopen ( $this->smtp, $this->port ); if ( $this->fp ) { set_socket_blocking( $this->fp, true ); $this->lastmessage=fgets($this->fp,512); $this->show_debug($this->lastmessage, "in"); if (! ereg ( "^220", $this->lastmessage ) ) { return false; } else { $this->lastact="HELO " . $this->welcome . "\n"; if(!$this->do_command($this->lastact, "250")) { fclose($this->fp); return false; } $this->lastact="MAIL FROM: $from" . "\n"; if(!$this->do_command($this->lastact, "250")) { fclose($this->fp); return false; } $this->lastact="RCPT TO: $to" . "\n"; if(!$this->do_command($this->lastact, "250")) { fclose($this->fp); return false; } //发送正文 $this->lastact="DATA\n"; if(!$this->do_command($this->lastact, "354")) { fclose($this->fp); return false; } //处理Subject头 $head="Subject: $subject\n"; if(!empty($subject) && !ereg($head, $message)) { $message = $head.$message; } //处理From头 $head="From: $from\n"; if(!empty($from) && !ereg($head, $message)) { $message = $head.$message; } //处理To头 $head="To: $to\n"; if(!empty($to) && !ereg($head, $message)) { $message = $head.$message; } //加上结束串 if(!ereg("\n\.\n", $message)) $message .= "\n.\n"; $this->show_debug($message, "out"); fputs($this->fp, $message); $this->lastact="QUIT\n"; if(!$this->do_command($this->lastact, "250")) { fclose($this->fp); return false; } } return true; } else { $this->show_debug("Connect failed!", "in"); return false; } } }?> 求:PHP中搜索结果分页的方法! 如何将多种不同的数据库查询结果集中显示到一个搜索结果页面? 发现FLASH总是在JAVASCRIPT之后才加载?如何解决这个问题? 请大家推荐一本学习PHP的经典书!来者有分! ThinkPHP多个Mysql链接 在数据库中 创建了表后网站中的很的错误 请问我当前想把我公司网站的内容转化为xml以提供RSS Feed,应该怎么利用网上的rss类呢? 为什么会提示“未定义,找不到index”错误 数据库替换问题 thinkphp 在本地环境无法打开 怎样取得另一个页面中list/menu中的当前数据值??50分 为何这apache2.0.47无法运行
<?php
class send_mail{
var $lastmessage; //记录最后返回的响应信息
var $lastact; //最后的动作,字符串形式
var $welcome; //用在HELO后面,欢迎用户
var $debug; //是否显示调试信息
var $smtp; //smtp服务器
var $port; //smtp端口号
var $fp; //socket句柄
function send_mail($smtp, $welcome="", $debug=false)
{
if(empty($smtp)) die("SMTP cannt be NULL!");
$this->smtp=$smtp;
if(empty($welcome))
{
$this->welcome=gethostbyaddr("61.243.232.26");
}
else
$this->welcome=$welcome;
$this->debug=$debug;
$this->lastmessage="";
$this->lastact="";
$this->port="25";
}
function show_debug($message, $inout)
{
if ($this->debug)
{
if($inout=="in") //响应信息
{
$m='<< ';
}
else
$m='>> ';
if(!ereg("\n$", $message))
$message .= "<br>";
$message=nl2br($message);
echo "<font color=#999999>${m}${message}</font>";
}
}
function do_command($command, $code)
{
$this->lastact=$command;
$this->show_debug($this->lastact, "out");
fputs ( $this->fp, $this->lastact );
$this->lastmessage = fgets ( $this->fp, 512 );
$this->show_debug($this->lastmessage, "in");
if(!ereg("^$code", $this->lastmessage))
{
return false;
}
else
return true;
}
function send( $to,$from,$subject,$message)
{
//连接服务器
$this->lastact="connect";
$this->show_debug("Connect to SMTP server : ".$this->smtp, "out");
$this->fp = fsockopen ( $this->smtp, $this->port );
if ( $this->fp )
{
set_socket_blocking( $this->fp, true );
$this->lastmessage=fgets($this->fp,512);
$this->show_debug($this->lastmessage, "in");
if (! ereg ( "^220", $this->lastmessage ) )
{
return false;
}
else
{
$this->lastact="HELO " . $this->welcome . "\n";
if(!$this->do_command($this->lastact, "250"))
{
fclose($this->fp);
return false;
}
$this->lastact="MAIL FROM: $from" . "\n";
if(!$this->do_command($this->lastact, "250"))
{
fclose($this->fp);
return false;
}
$this->lastact="RCPT TO: $to" . "\n";
if(!$this->do_command($this->lastact, "250"))
{
fclose($this->fp);
return false;
}
//发送正文
$this->lastact="DATA\n";
if(!$this->do_command($this->lastact, "354"))
{
fclose($this->fp);
return false;
}
//处理Subject头
$head="Subject: $subject\n";
if(!empty($subject) && !ereg($head, $message))
{
$message = $head.$message;
}
//处理From头
$head="From: $from\n";
if(!empty($from) && !ereg($head, $message))
{
$message = $head.$message;
}
//处理To头
$head="To: $to\n";
if(!empty($to) && !ereg($head, $message))
{
$message = $head.$message;
}
//加上结束串
if(!ereg("\n\.\n", $message))
$message .= "\n.\n";
$this->show_debug($message, "out");
fputs($this->fp, $message);
$this->lastact="QUIT\n";
if(!$this->do_command($this->lastact, "250"))
{
fclose($this->fp);
return false;
}
}
return true;
}
else
{
$this->show_debug("Connect failed!", "in");
return false;
}
}
}?>