EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Unable to send mail with NTLM authentication (VCL)

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 09/20/2012 09:55:45
by Josep Saumell (Standard support level)
Joined: 04/11/2008
Posts: 15

Using CodeGear RAD Studio 2007, I'm trying to sent an email againts a server that requires NTLM authentication for sending mail to addresses out of the domain. Here is the code:

procedure TForm1.Button1Click(Sender: TObject);
Fmail := TELMessage.Create('');
FListAdress := TElMailAddressList.Create('');

with Fsmtp do begin
Address := SMTPDomain;
//SASLMechanism['NTLM'] := true; ---???
Port := 25;
Username := SMTPUser;
Password := SMTPPassword;
with Fmail do begin


As long as this line is commented ( //SASLMechanism['NTLM'] := true; ---???) it works for in-company addresses, but I'm not able to sent emails out of the domain. If I uncomment that line, the server responds with:

"Unaccepted server reply for command <encripted text> (error code is 535)"

What I'm doing wrong?
Posted: 09/20/2012 10:11:20
by Vsevolod Ievgiienko (Team)

Thank you for contacting us.

Try to increase NTLM priority using TElSMTPClient.SASLMechanismPriorities property to make if the most preferred mechanism: http://www.eldos.com/documentation/sb...ities.html
Posted: 09/20/2012 10:39:46
by Josep Saumell (Standard support level)
Joined: 04/11/2008
Posts: 15

Hi again,

I can query the current value of the property SASLMechanismPriorities (and it is 0), but I can't assign any value (in Delphi VCL is read only????)

Posted: 09/20/2012 10:41:56
by Vsevolod Ievgiienko (Team)

The code should look like this:
SmtpClient.SASLMechanismPriorities['NTLM'] := 100;
Posted: 09/20/2012 10:50:46
by Josep Saumell (Standard support level)
Joined: 04/11/2008
Posts: 15

It's my fault. The value 100 has been assigned correctly. But the error it's still the same when executing 'Login' method:

"Unaccepted server reply for command <encripted text> (error code is 535)"
Posted: 09/20/2012 10:58:38
by Vsevolod Ievgiienko (Team)

535 error code stands for "SMTP Authentication unsuccessful/Bad username or password". Are you able to send an email using some other SMTP client?

Also you should check if TElSMTPClient.ExtSASLMechanisms includes NTLM after the Open method is called. Its possible that NTLM is not enabled on the server.
Posted: 09/21/2012 04:49:50
by Josep Saumell (Standard support level)
Joined: 04/11/2008
Posts: 15

I've tried to send against the same server using a SMTP tool (febootimail) with NTLM authentication with same credentials and it works.

Am I missing something in the code?
Posted: 09/21/2012 04:55:18
by Vsevolod Ievgiienko (Team)

Your code is correct. Do you use the latest 10th build? NTLM authentication was tested recently and should works without any problems.

If you can give us access to your server we'll investigate the problem.
Posted: 09/21/2012 05:19:10
by Josep Saumell (Standard support level)
Joined: 04/11/2008
Posts: 15

Sorry, I can't allow you to connect to our server.

By the way, I'm using this version of SBB:

Release: SecureBlackbox (VCL edition) for Delphi 2005, BDS 2006, CodeGear RAD Studio 2007 (Delphi/Win32 personality), pre-compiled version (requires license key) - Version 9.1.217. Released on 2012-09-10.

Hope you can help me...
Posted: 09/21/2012 05:22:05
by Vsevolod Ievgiienko (Team)

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.



Topic viewed 4658 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!