后退语句怎么写
请问后退语句我该怎么写.
作者 Lonely 发布于 2003-09-02 分类:php基础编程
[PHP]
<?
set_time_limit("0");
function result() {
global $socket;
$result = fgets($socket);
echo $result,"
";
}
$socket = fsockopen("smtp.263.net","25");
set_socket_blocking($socket,true);
result();
fputs($socket,"HELO try
");
result();
fputs($socket,"MAIL FROM: langjia@tom.com
");
result();
fputs($socket,"RCPT TO: langjia@tom.com
");
result();
fputs($socket,"DATA
");
result();
fputs($socket,"To: langjia@tom.com
");
result();
fputs($socket,"From: langjia@tom.com
");
result();
fputs($socket,"Subject: This is test mail
");
result();
fputs($socket,"This is test mail.
");
result();
fputs($socket,"QUIT
");
result();
fclose($f);
?>
[/PHP]
这段代码无法发送,请问哪里错了?
逛论坛交流:关于使用PHP的sock发送Email
不好意思,這個問題難了嗎?
沒人研究過嗎?
没有smtp的身份验证
原來是這樣,要通過身份驗證要怎麽寫呢?
冬冬资料库里面有这样的类
不好意思,我不知道網址,能貼出來嗎?
搜索冬冬,就可以找到了
[php]
<?
set_time_limit("0");
function result() {
global $socket;
$result = fgets($socket);
echo $result,"
";
}
$socket = fsockopen("smtp.tom.com","25");
set_socket_blocking($socket,true);
fputs($socket,"HELO try
");
fputs($socket,"AUTH LOGIN
");
fputs($socket,base64_encode("langjia")."
");
fputs($socket,base64_encode("password")."
");
fputs($socket,"MAIL FROM: langjia@tom.com
");
fputs($socket,"RCPT TO: langjia@tom.com
");
fputs($socket,"DATA
");
$send = "From: langjia@tom.com
"."To: langjia@tom.com"."Subject:test
This is test mail
.
";
fputs($socket,$send);
result();
fclose($socket);
?>
[/php]这是我最后完成的,可以发送邮件,但是收到的邮件没有标题?这是怎么回事?
标题?
你的代码里面就没有
$send = "From: langjia@tom.com
"."To: langjia@tom.com"."Subject:test
This is test mail
.
";
Subject: test就是标题啊,看看是不是这里错了?
10 条回复
回复