简体   繁体   English

phpmailer与交换,没有SSL或TLS

[英]phpmailer with exchange and no SSL or TLS

I've been working on this problem for the past 2 days and everything that i tried is still not working. 在过去的2天里,我一直在解决这个问题,但我尝试的所有方法仍然无法正常工作。 I'm trying to authenticate to an exchange server with php so i can send to outside domains. 我正在尝试使用php验证到交换服务器,以便可以发送到外部域。

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 这是phpmailer代码

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 我尝试了不同版本的phpmailer,我尝试使用base64编码密码,我尝试仅使用用户名,我尝试将电子邮件用作用户名...仍然没有

The exchange server is on port 25 and it does not require SSL or TLS. 交换服务器位于端口25上,不需要SSL或TLS。

SMTP -> FROM SERVER: ... 250-AUTH NTLM SMTP->从服务器:... 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. 服务器只希望使用NTLM身份验证,而不能使用仅可以使用用户名和密码使用的LOGIN,PLAIN或DIGEST-MD5身份验证。 You would also need the NTLM realm and your workstation. 您还需要NTLM领域和您的工作站。

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. 不幸的是,关于它的文档并不多,但是您可以访问http://www.phpclasses.org/browse/file/31.html,并寻找NTLM来了解如何执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM