最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
用SMTP传送邮件时的问题
时间:2022-07-02 10:33:09 编辑:袖梨 来源:一聚教程网
下面是我找到的一个直接使用smtp发送邮件的php例子程序(经改编), 但是服务器方总是提示: 550 system busy! 并且邮件无法发送.
那位知道如何处理?
另: 对于smtp服务器需要密码的情况该如何处理验证呢?
sory , 刚刚看到 smtp 发送邮件的问题 (链接的这个帖子怎么不是精华?, 建议斑竹给一个啊).
问题已经解决:
1. 命令data应该是"DATA "
2. from和to命令应该有, 否则一些server拒发邮件
3.使用base64_encode 加密用户名和密码
require("phpmail.php");
?>
$smtp = "smtp.163.net";
$from ="hylpro@163.net";
$to = "hylpro@163.net";
$subject ="Hello php mail";
$message="Hello! this is a test use php";
$mail = new mail($smtp,"Welcom use this mail",true);
$mail->send( $to,$from,$subject,$message);
?>
//---------------
// 实现SMTP
//---------------
class Mail{
var $lastmessage; //记录最后返回的响应信息
var $lastact; //最后的动作,字符串形式
var $welcome; //用在HELO后面,欢迎用户
var $debug; //是否显示调试信息
var $smtp; //smtp服务器
var $port; //smtp端口号
var $fp; //socket句柄
//Construct
function mail($smtp, $welcome="", $debug=false)
{
if(empty($smtp)) die("SMTP cannt be NULL!");
$this->smtp=$smtp;
if(empty($welcome))
{
$this->welcome=gethostbyaddr("localhost");
}
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 .= " ";
那位知道如何处理?
另: 对于smtp服务器需要密码的情况该如何处理验证呢?
sory , 刚刚看到 smtp 发送邮件的问题 (链接的这个帖子怎么不是精华?, 建议斑竹给一个啊).
问题已经解决:
1. 命令data应该是"DATA "
2. from和to命令应该有, 否则一些server拒发邮件
3.使用base64_encode 加密用户名和密码
require("phpmail.php");
?>
$smtp = "smtp.163.net";
$from ="hylpro@163.net";
$to = "hylpro@163.net";
$subject ="Hello php mail";
$message="Hello! this is a test use php";
$mail = new mail($smtp,"Welcom use this mail",true);
$mail->send( $to,$from,$subject,$message);
?>
//---------------
// 实现SMTP
//---------------
class Mail{
var $lastmessage; //记录最后返回的响应信息
var $lastact; //最后的动作,字符串形式
var $welcome; //用在HELO后面,欢迎用户
var $debug; //是否显示调试信息
var $smtp; //smtp服务器
var $port; //smtp端口号
var $fp; //socket句柄
//Construct
function mail($smtp, $welcome="", $debug=false)
{
if(empty($smtp)) die("SMTP cannt be NULL!");
$this->smtp=$smtp;
if(empty($welcome))
{
$this->welcome=gethostbyaddr("localhost");
}
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 .= " ";
相关文章
- 失落的方舟布兰斯怎么获得 05-02
- 英雄无敌5怎么收集古代宝物 05-02
- 攻城掠地铁如何换宝石 05-02
- 全民奇迹勋章怎么获得 05-02
- 少年三国志西域如何攻打城池 05-02
- 百英雄传前期队伍推荐 05-02