0 votes
by (120 points)

My app logs in to my company's SMTP server when I'm behind the firewall but the same code fails when I'm outside the firewall connected via VPN. Here's the relevant code:

// Instantiate an SMPT client and set the required properties
client = new Smtp();
client.Connect("owa.central.com", 25, Rebex.Net.SslMode.None);
client.Login("cgp\\eml_penn_mdp", "password");

When I'm outside the firewall, the Login method throws the following error:

An unhandled exception of type 'Rebex.Net.SmtpException' occurred in Rebex.Smtp.dll

Additional information: None of the supported authentication methods is accepted by the server.

I'm using the latest versions of the Rebex assemblies:

Rebex.Common - 2.0.5512.0
Rebex.Mail - 2.0.5512.0
Rebex.Networking - 3.0.5512.0
Rebex.Smtp - 2.0.5512.0

I figured the code would behave the same with a VPN connection as it would behind the firewall. Not true.

Any ideas?

Applies to: Rebex Secure Mail

2 Answers

0 votes
by (148k points)

Actually, it's quite possible that the code does behave the same with a VPN connection as it would behind the firewall, but that the server is behaving differently. At this point, it's only a guess. A communication log should make it possible to tell what is actually going on.

Could you please use Smtp object's LogWriter property to create two communication logs, one with a VPN connection and other behind the firewall, and either add them to your question or mail them to support@rebex.net? Thanks!

by (120 points)
Hi Lukas,

I selected "verbose" on the log files so I figured it best to attach them to the email.  Sending now.
by (58.9k points)
I checked our support@rebex.net inbox and we have not received the email from you. Would it be possible to try resending your logs to our alternative support.rebex.net@gmail.com account? If you chose the LogLevel.Verbose, please also make sure to delete your password from the log before sending it. Or use the LogLevel.Debug which usually  contains enough information.
by (120 points)
Hi Tomas,

Thanks for birddogging this issue.

I resent the logs - this time to support.rebex.net@gmail.com.  Also included support@rebex.net in the "To:" line.  Hopefully they'll make it this time.
by (148k points)
Thanks a lot, the logs made it to both addresses this time. I've just added a new answer to your question: http://forum.rebex.net/5194/cannot-login-to-smtp-client-via-vpn-connection?show=5204#a5204
+1 vote
by (148k points)
edited by

Update: This has been fixed in Rebex Secure Mail 2015 R2.

We analyzed the logs we got from you and discovered that you are actually using two different versions of Rebex Secure Mail - when "inside" the firewall, you use 2013 R2 (build 4981). But when "outside" the firewall, you use 2015 R1 (build 5512).

Further analysis revealed that the error you encountered is caused by a bug in Rebex Secure Mail that first appeared in 2013 R3 and stayed unnoticed until now. This is clearly a mistake on our part and we appologize for any inconvenience this may have caused. We will fix it as possible. If you (or anyone else) need a hotfix, please let us know.

Alternatively, as a workaround, you might change your code to explicitly specify that NTLM authentication is to be used with this server:

client.Login("cgp\\eml_penn_mdp", "password", SmtpAuthentication.Ntlm);

This should solve the issue, but it will only work with servers that support NTLM. If you would like something universal, please use this code instead:

var methods = client.GetSupportedAuthenticationMethods();
if (Array.IndexOf(methods, SmtpAuthentication.GssApi) >= 0)
    client.Login(userName, password, SmtpAuthentication.GssApi);
else if (Array.IndexOf(methods, SmtpAuthentication.Ntlm) >= 0)
    client.Login(userName, password, SmtpAuthentication.Ntlm);
else
    client.Login(userName, password, SmtpAuthentication.Auto);

Thanks for bringing this issue to our attention!

by (120 points)
Fixed!!!

The company's server supports NTLM so the simple fix worked.

I'd like to take a moment to tell you how much I appreciate the excellent tech support.  Many years ago, I started using Rebex's FTP client for Windows Mobile.  Early on I encountered a problem and Rebex tech support worked very hard to help me solve it.  I haven't needed to consult tech support on any other issues until just now.  Again, I am thrilled with the way Rebex handled things.  Sadly, we now live in a world where fly-by-night companies sell crummy software with little or no support.  The hapless developer often ends up holding the bag.  Rebex stands as a shining example of the way software companies should be.  I wish you great success.

Many thanks,

JCC
...