测试源码如下:
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.163.com";
$mail->Port=25;
$mail->SMTPAuth = true;
$mail->Username = "[email protected]"; // SMTP用户名
$mail->Password = "xxxx"; // SMTP密码
$mail->From = "[email protected]"; //发件人地址
$mail->FromName = "xxx"; //发件人
$mail->AddAddress("[email protected]");
$mail->AddReplyTo("[email protected]", "Information"); //回复地址
$mail->WordWrap = 50; //设置每行字符长度
$mail->IsHTML(true); // 是否HTML格式邮件
$mail->Subject = "Here is the subject"; //邮件主题
$mail->Body    = "HERE is the message"; //邮件内容
$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //邮件正文不支持HTML的备用显示if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}echo "Message has been sent";在本地wamp下测试一切正常,上传到空间之后就出错:
SMTP Error: Could not connect to SMTP host.
Mailer Error: SMTP Error: Could not connect to SMTP host.空间sockets,openssl都是enabled,寻求一个解决方法....