Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: NTLM auth not working on Exchange 2010 Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
hubertn
Newbie
Newbie
Avatar

Joined: 04 June 2013
Location: Netherlands
Online Status: Offline
Posts: 1
Posted: 04 June 2013 at 4:46am | IP Logged Quote hubertn

Unable to send mail via SMTP on Exchange Server 2010 with SASL NTLM authentication. Error response is:
"The server has rejected authentication data sent by the client. The server responded: 535 5.7.3 Authentication unsuccessful"

Sample code used:
-----------------

using MailBee;
using MailBee.SmtpMail;
using MailBee.Security;

class Test
{
   [STAThread]
   static void Main(string[] args)
   {
      try
      {
        Global.LicenseKey = <snip>;
        Smtp mailer = new Smtp();

        // See in the log file what exactly happens during authentication.
        mailer.Log.Enabled = true;
        mailer.Log.Filename = "C:\\Temp\\log.txt";
        mailer.Log.Clear();

        // Use SMTP relay with authentication (take credentials from Windows).
        SmtpServer relay = mailer.SmtpServers.Add("ms-gda02.its.centric.lan", null, null);

        // Allow methods which can do Integrated Windows Authentication.
        relay.AuthMethods = MailBee.AuthenticationMethods.SaslNtlm | MailBee.AuthenticationMethods.SaslGssApi;
        relay.SmtpOptions = ExtendedSmtpOptions.NoChunking;
        relay.SslMode = SslStartupMode.UseStartTlsIfSupported;

        // Compose and send an e-mail.
        mailer.From.Email = "hubert.nooijen@centric.eu";
        mailer.To.Add("hubert.nooijen@centric.eu");
        mailer.Subject = "Test message";
        mailer.Send();
      }
      catch (Exception ex)
      {
        Console.WriteLine(ex.Message);
      }
   }
}

Log file contents:
------------------
[13:20:49.32] [INFO] Assembly version: 7.3.4.388.
[13:20:49.31] [INFO] Will send mail message.
[13:20:49.48] [INFO] Will resolve host "ms-gda02.its.centric.lan".
[13:20:49.49] [INFO] Host "ms-gda02.its.centric.lan" resolved to IP address(es) 10.15.1.8.
[13:20:49.49] [INFO] Will connect to host "ms-gda02.its.centric.lan" on port 25.
[13:20:49.51] [INFO] Socket connected to IP address 10.15.1.8 on port 25.
[13:20:49.52] [RECV] 220 MS-GDA02.its.centric.lan Microsoft ESMTP MAIL Service ready at Tue, 4 Jun 2013 13:20:48 +0200\r\n
[13:20:49.52] [INFO] Connected to mail service at host "ms-gda02.its.centric.lan" on port 25 and ready.
[13:20:49.54] [INFO] Will send Hello command (HELO or EHLO).
[13:20:49.56] [SEND] EHLO [10.15.240.68]\r\n
[13:20:49.56] [RECV] 250-MS-GDA02.its.centric.lan Hello [10.15.240.68]\r\n250-SIZE\r\n250-PIPELINING\r\n250-DSN\r\n250-ENHANCEDSTATUSCODES\r\n250-STARTTLS\r\n250-X-ANONYMOUSTLS\r\n250-AUTH NTLM\r\n250-X-EXPS GSSAPI NTLM\r\n250-8BITMIME\r\n250-BINARYMIME\r\n250-CHUNKING\r\n250-XEXCH50\r\n250 XRDST\r\n
[13:20:49.57] [INFO] SMTP Hello completed.
[13:20:49.57] [INFO] Notify server that we are ready to start TLS/SSL negotiation.
[13:20:49.57] [SEND] STARTTLS\r\n
[13:20:49.57] [RECV] 220 2.0.0 SMTP server ready\r\n
[13:20:49.95] [INFO] Will send Hello command (HELO or EHLO).
[13:20:49.95] [SEND] EHLO [10.15.240.68]\r\n
[13:20:49.95] [RECV] 250-MS-GDA02.its.centric.lan Hello [10.15.240.68]\r\n250-SIZE\r\n250-PIPELINING\r\n250-DSN\r\n250-ENHANCEDSTATUSCODES\r\n250-AUTH NTLM LOGIN\r\n250-X-EXPS GSSAPI NTLM\r\n250-8BITMIME\r\n250-BINARYMIME\r\n250-CHUNKING\r\n250-XEXCH50\r\n250 XRDST\r\n
[13:20:49.95] [INFO] SMTP Hello completed.
[13:20:49.96] [INFO] Will login as "".
[13:20:49.98] [INFO] Will try SASL NTLM authentication method.
[13:20:49.98] [SEND] AUTH NTLM\r\n
[13:20:49.98] [RECV] 334 \r\n
[13:20:49.99] [SEND] YHkGBisGAQUFAqBvMG2gMDAuBgorBgEEAYI3AgIKBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKwYBBAGCNwICHqI5BDdOVExNU1NQAAEAAACXsgjiAwADADQAAAAMAAwAKAAAAAYBsR0AAAAPTkIyLUhOT09JSkVOSVRT\r\n
[13:20:54.98] [RECV] 535 5.7.3 Authentication unsuccessful\r\n
[13:20:56.05] [INFO] Will disconnect from host "ms-gda02.its.centric.lan".
[13:20:56.06] [INFO] Disconnected from host "ms-gda02.its.centric.lan".
[13:20:56.06] [INFO] Error: The server has rejected authentication data sent by the client. The server responded: 535 5.7.3 Authentication unsuccessful\r\n.
------------------

I'm completely puzzled as why this code fails, with or without SSL. Account name and password are NULL as required; if they're filled in the code succeeds and mail is sent, but this defeats the purpose of Integrated Windows Authentication!
Back to Top View hubertn's Profile Search for other posts by hubertn
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6104
Posted: 04 June 2013 at 11:55am | IP Logged Quote Igor

I understand MS Exchange 2010 only supports GSSAPI authentication, so try using MailBee.AuthenticationMethods.SaslGssApi only and see if that helps.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide