通过socket发送smtp邮件,大部分邮件服务器是需要smtp验证的。
新建一个stmp_mail对象的时候,要指定服务器,帐号,密码等信息$host = "mail.yourdomain.com";
$port = "25";
$user = "[email protected]";
$pass = "123456";
//以上这些信息必须正确填写$smtp = smtp_mail($host,$port,$user,$pass)该类的构造函数也需要修改,如下。
function smtp_mail($host,$port,$user,$pass,$debug=false)
{
$this->host = $host;
$this->port = $port;
$this->user = base64_encode($user);
$this->pass = base64_encode($pass);
新建一个stmp_mail对象的时候,要指定服务器,帐号,密码等信息$host = "mail.yourdomain.com";
$port = "25";
$user = "[email protected]";
$pass = "123456";
//以上这些信息必须正确填写$smtp = smtp_mail($host,$port,$user,$pass)该类的构造函数也需要修改,如下。
function smtp_mail($host,$port,$user,$pass,$debug=false)
{
$this->host = $host;
$this->port = $port;
$this->user = base64_encode($user);
$this->pass = base64_encode($pass);
那refresh.php里的
<?
//每刷新一次换一个mail地址
$smtp = new smtp_mail;
$smtp->send("test","mail地址","title","content");
?>send("test","mail地址","title","content");
这个是不是也得改?**********************************************************************
var $host; //主机
var $port; //端口 一般为25
var $user; //SMTP认证的帐号
var $pass; //认证密码
var $debug = false; //是否显示和服务器会话信息?
var $conn;
var $result_str; //结果
var $in; //客户机发送的命令
var $from; //源信箱
var $to; //目标信箱
var $subject; //主题
var $body; //内容 这些用改吗???
******************************************************************$host = "mail.yourdomain.com";
$port = "25";
$user = "[email protected]";
$pass = "123456";这块我改了,但提示错误:
Warning: Missing argument 1 for smtp_mail() in /www/smtp.php on line 16Warning: Missing argument 2 for smtp_mail() in /www/smtp.php on line 16Warning: Missing argument 3 for smtp_mail() in /www/smtp.php on line 16Warning: Missing argument 4 for smtp_mail() in /www/smtp.php on line 16Fatal error: Call to undefined function: socket_create() in /www/smtp.php on line 23就是这两行有问题:
“function smtp_mail($host,$port,$user,$pass,$debug=false) ”
“$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); //具体用法请参考手册 ”咋办? 请高高手耐心讲讲 小弟就靠前辈们了!!先谢谢您
猜的:参数不对,function smtp_mail($host,$port,$user,$pass)
<? $host = "mail.yourdomain.com";
$port = "25";
$user = "[email protected]";
$pass = "123456";
//以上这些信息要真实存在,并且mail.yourdoamin.com:25是对外开放的。
$smtp = smtp_mail($host,$port,$user,$pass)
$smtp->send("test","mail地址","title","content");
?>类的构造函数也需要修改,如下。
function smtp_mail($host,$port,$user,$pass,$debug=false)
{
//改以下4行
$this->host = $host;
$this->port = $port;
$this->user = base64_encode($user);
$this->pass = base64_encode($pass);
...
}
//每刷新一次换一个mail地址
$smtp = new smtp_mail;
$smtp->send("test","mail地址","title","content");
?>每刷新一次换一个mail地址
哪里的程序是实现刷新的?
$smtp = smtp_mail($host,$port,$user,$pass);//这行加上个分号
$smtp->send("test","[email protected]","title","content");
16行:“function smtp_mail($host,$port,$user,$pass,$debug=false) ”
23行:“$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); //具体用法请参考手册 ”不太明白怎么调试,前辈们请指点讲讲啊!!!!谢谢了!!!!!!!!!!!!
23行:“$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); //具体用法请参考手册 ”卡在这里了!!怎么办啊!!555555
又有问题了!
1)调是调通了,可使这两个程序不能给外界的EMAIL发啊,比如SINA,126,(使本公司的邮件服务器)2)我以前使mail()函数发邮件,通过fopen()打开带有EMAIL地址的TXT文本(格式如下)。
[email protected]
[email protected]
[email protected]
这样就能陆续发送,可使上面的程序只能发一条(而且接到邮件的内容还是这样,如下),回车后的发送不了啊?!为啥?“Subject:EMAIL标题
X-Priority: 3
X-MSMail-Priority: Normal
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
Date: Wed, 13 Sep 2006 14:38:19 +0800
X-Mailer:By Redhat (PHP/4.3.8)
Message-ID: <[email protected]>
Content-Type: text/html
X-Brightmail-Tracker: AAAAAQAAAAQ=
Resent-Message-Id: <44714DA9.04DBDB.21903>
Resent-Date: Wed, 13 Sep 2006 14:38:19 +0800
EMAIL内容”这都写的啥?看不明白啊?!急急!!
[email protected]
[email protected]
...上面的程序是不是得相应修改?改哪里?谢谢高手啊 !!!
我吧debug打开 显示信息,其中:
发送成功会显示:Recipient ok
发送错误会显示:Relaying denied. Proper authentication required. 但我想统计出发送成功多少条,发送失败多少条,都有哪些(明细)这个要怎么做啊?高手们帮帮忙~~~~
但收到邮件,一看地址这样:
/"www.sina.com\"
再点击后弹出IE窗口,可IE窗口地址栏是如下内容:
res://shdoclc/syntax.htm#\"www.sina.com\"这是为什么啊?!