duanqianruan8448 2016-02-20 21:24
浏览 160
已采纳

phpmailer与交换,没有SSL或TLS

I've been working on this problem for the past 2 days and everything that i tried is still not working. I'm trying to authenticate to an exchange server with php so i can send to outside domains.

If i disable authentication, i can send internally without any issues.

Here's the error

SMTP -> FROM SERVER:220 N-CAS1-13.company.domain Microsoft ESMTP MAIL Service ready at Sat, 20 Feb 2016 16:16:05 -0500
SMTP -> FROM SERVER: 250-N-CAS1-13.company.domain Hello [10.10.10.31] 250-SIZE 37748736 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-X-        ANONYMOUSTLS 250-AUTH NTLM 250-X-EXPS GSSAPI NTLM 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 XRDST
SMTP -> ERROR: AUTH not accepted from server: 504 5.7.4 Unrecognized authentication type
SMTP -> FROM SERVER:250 2.0.0 Resetting
SMTP Error: Could not authenticate. 

Here's the phpmailer code

require "phpmailer/class.phpmailer.php"; //include phpmailer class
//require "PHPMailer-5.2.14/PHPMailer-5.2.14/PHPMailerAutoload.php";



$mail = new PHPMailer();  


$mail->IsSMTP();              
$mail->SMTPAuth = true;  
$mail->SMTPDebug = 2;       
$mail->SMTPSecure = false;       
$mail->Host = "10.10.10.38";
$mail->Port = 25;  


$mail->Username   = "username"; 
$mail->Password   = "cGhpbGltaWVzMjM2OTY5"; 

 $mail->From = "name@companydomain.com";
 $mail->FromName = "name";
 $mail->SetFrom("name@companydomain.com", "name");


$mail->Subject = $_POST['company'].": (Time Sensitive)";  
$mail->AddEmbeddedImage('trans2.png', 'logo', 'trans2.png ');


$mail->AddAttachment("docs/install.xlsx");
$mail->MsgHTML($message1.$message2.$message3);



// Send To  
$mail->AddAddress($_POST['emailid'], ""); // Where to send it - Recipient
$mail->AddCC("person@companydomain.com");
$result = $mail->Send();        // Send!  
$message = $result ? 'Successfully Sent!' : 'Sending Failed!';      
unset($mail);

}

I tried different version of phpmailer, i tried encoding the password with base64, i tried just the username, i tried the email as the username...Still nothing

The exchange server is on port 25 and it does not require SSL or TLS.

  • 写回答

1条回答 默认 最新

  • dt56449492 2016-02-21 07:30
    关注

    SMTP -> FROM SERVER: ... 250-AUTH NTLM

    The server is only expecting NTLM authentication, not LOGIN, PLAIN or DIGEST-MD5 which could be used with only username and password. You would also need the NTLM realm and your workstation.

    Unfortunately there is not much documentation about it but you might have a look at http://www.phpclasses.org/browse/file/31.html and look for NTLM to get the idea how to do this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况