Reputation: 1
I built a Ubuntu Server in our network segment and want it to send mail with PHPMailer. Mailserver and Webserver is in same segment (all in 192.168.37.XX).
Lastweek my mailserver was overload and I restarted it. after that, PHPMailer in Webserver doesn't work (I didn't change anything in Mailserver or Webserver, Mailserver is Exchange Mailserver and I just restarted it, nothing changed).
I tried with my localhost (127.0.0.1) and PHPMailer works well, Debug log shows AUTH type is "LOGIN". but in Webserver, Debug log shows AUTH type is "NTLM " and shows following error. Code in Localhost and Webserver is all same. I tried with my another Webserver which built in other network segment, it also works.
Debug Error: "AUTH NTLM 250-X-EXPS GSSAPI NTLM 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250-XEXCH50 250 XRDST 2021-05-09 09:27:31 CLIENT -> SERVER: AUTH NTLM TlRMTVNTUAABAAAABzIAAAAAAAAgAAAAAAAAACAAAAA= 2021-05-09 09:27:36 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful 2021-05-09 09:27:36 SMTP ERROR: AUTH NTLM command failed: 535 5.7.3 Authentication unsuccessful",
require_once('class.phpmailer.php');
require_once('class.smtp.php');
$mail = new PHPMailer(true);
$mail->IsSMTP(); // enable SMTP
$mail->SMTPAuth = true; // authentication enabled
$mail->IsHTML(true);
$mail->SMTPDebug = 2;
$mail->Host = "mail.mailserver.com";
$mail->SMTPSecure ='starttls';
$mail->Port = 587;
$mail->Username = $username;
$mail->Password = $password;
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mail->SetFrom("[email protected]", "XXXX");
$mail->Subject = "Subject";
$mail->Body = "OKOK";
$mail->AddAddress("[email protected]");
$mail->Send();
Now I'm using gmail smtp, it works but very slow. I still want to use my own mailserver. can someone help? thanks!
Upvotes: 0
Views: 258
Reputation: 1
Just fixed with following code:
$mail->SMTPSecure = 'ntlm';
$mail->Realm = "MailServerDomain";
$mail->Workstation = "WORKSTATION1";
Upvotes: 0