错误信息如下:Warning: file(http://community.csdn.net/Expert/topic/3169/3169165.xml?temp=.1288721): failed to open stream: Bad file descriptor in F:\ctsgz\jion.php on line 10Warning: join(): Argument to implode must be an array. in F:\ctsgz\jion.php on line 10
to: xuzuning(唠叨) 我改为下面这样就出现了这样: echo join('\n',file("http://community.csdn.net/Expert/topic/3169/3169165.xml?temp=.1288721")); 就出现了这样的错误: Warning: file(http://community.csdn.net/Expert/topic/3169/3169165.xml?temp=.1288721): failed to open stream: Bad file descriptor in F:\ctsgz\jion.php on line 10Warning: join(): Bad arguments. in F:\ctsgz\jion.php on line 10 为什么会出现这样的情况呢?
<?php require("class.phpmailer.php");$mail = new PHPMailer();$mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "ms1.apachefootwear.com;ms1.apachefootwear.com"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "siney-wang"; // SMTP username $mail->Password = "12060708"; // SMTP password$mail->From = "[email protected]"; $mail->FromName = "Mailer"; $mail->AddAddress("[email protected]", "SINEY"); $mail->AddAddress("[email protected]"); // name is optional //$mail->AddReplyTo("[email protected]", "Information");$mail->WordWrap = 50; // set word wrap to 50 characters //$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name $mail->IsHTML(true); // set email format to HTML$mail->Subject = "Here is the subject"; $mail->Body = "This is the HTML message body <b>in bold!</b>"; $mail->AltBody = "This is the body in plain text for non-HTML mail clients";if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; }echo "Message has been sent"; ?>
我用OUTLOOK时设置的服务器和端口就是这样的啊!
程序就是直接用MAIL()函数了,没有其它的设置。
把它关了试一试
2、网络问题
以上一般可排除3、服务方对连接请求做了限制
4、使用了代理第4条最重要,fsockopen()是不能穿过代理服务器的
确定没有用代理服务器
端口也没错
同时在关了OUTLOOK的情况下也出现同样的错误信息
echo join(file("http://community.csdn.net/Expert/topic/3169/3169165.xml?temp=.1288721"));
看看会有什么结果
我改为下面这样就出现了这样:
echo join('\n',file("http://community.csdn.net/Expert/topic/3169/3169165.xml?temp=.1288721"));
就出现了这样的错误:
Warning: file(http://community.csdn.net/Expert/topic/3169/3169165.xml?temp=.1288721): failed to open stream: Bad file descriptor in F:\ctsgz\jion.php on line 10Warning: join(): Bad arguments. in F:\ctsgz\jion.php on line 10
为什么会出现这样的情况呢?
require("class.phpmailer.php");$mail = new PHPMailer();$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "ms1.apachefootwear.com;ms1.apachefootwear.com"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "siney-wang"; // SMTP username
$mail->Password = "12060708"; // SMTP password$mail->From = "[email protected]";
$mail->FromName = "Mailer";
$mail->AddAddress("[email protected]", "SINEY");
$mail->AddAddress("[email protected]"); // name is optional
//$mail->AddReplyTo("[email protected]", "Information");$mail->WordWrap = 50; // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true); // set email format to HTML$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}echo "Message has been sent";
?>
telnet ms1.apachefootwear.com 25
看是否出现类似
220 Coremail SMTP(Anti Spam) System (163com[20030606])
这样的东西,如果存在,则服务器和网络都是没有问题的,则检查代码
如果出现
C:\Documents and Settings\Administrator>telnet pop.163.com 25
正在连接到pop.163.com...无法打开到主机的连接 在端口 25 : 连接失败
这样的东西,则是服务器或是网络问题。比如是否做了代理啊,邮件服务器的端口啊,等等。