0 votes
by (170 points)
edited

Hello

I'm evaluating Rebex software to replace a component that send email. The mail is sent to an Exchange 2010 server with an SMTP connector that accept login/password authentication

The original test code (using standard .NET classes) is very simple:

SmtpClient smtpClient = new SmtpClient("10.0.0.150", 25);
smtpClient.Credentials = new System.Net.NetworkCredential("testA@xxx.local", "xxxx");
MailMessage message = new MailMessage("testA@xxx.local", "testA@xxx.local", "Test " + DateTime.Now.ToString(), "This is a test email (old version)");
smtpClient.Send(message);

This works fine. No replace the same code by Rebex code:

Rebex.Mail.MailMessage message = new Rebex.Mail.MailMessage();
message.Subject = "Test " + DateTime.Now.ToString();
message.To.Add(new Rebex.Mime.Headers.MailAddress("testA@xxx.local", "Fab"));
message.From.Add(new Rebex.Mime.Headers.MailAddress("testA@xxx.local", "Fab"));
message.BodyText = "This is a test email";

Rebex.Net.Smtp smtp = new Rebex.Net.Smtp();
smtp.Connect("10.0.0.150");
smtp.Login("testA@xxx.local", "xxxx");
smtp.Send(message);

And this code thrown an error:

Rebex.Net.SmtpException: None of the supported authentication methods is accepted by the server. at Rebex.Net.Smtp.Login(String userName, String password, SmtpAuthentication method) at Rebex.Net.Smtp.Send(MimeMessage message, SmtpConfiguration configuration) at Rebex.Net.Smtp.Send(MailMessage message, SmtpConfiguration configuration)

I've tried with AuthenticationMethod = Login, but it also doesn't work As this code is very simple, I suppose that I'm doing something wrong, but what ?

Thank you for your help

EDIT: Here is the complete debug log

2012-07-12 17:54:42.748 Opening log file.
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Info: Connecting to 10.0.0.150:25 using Smtp 2.0.4546.0 (trial version).
2012-07-12 17:54:42.748 DEBUG Smtp(1)[1] Info: Connection succeeded.
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 220 mail.xxx.local Microsoft ESMTP MAIL Service ready at Thu, 12 Jul 2012 17:54:41 +0200
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Command: EHLO win7-2007a
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-mail.xxx.local Hello [10.0.0.108]
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-SIZE 25845760
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-PIPELINING
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-DSN
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-ENHANCEDSTATUSCODES
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-AUTH
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-8BITMIME
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250-BINARYMIME
2012-07-12 17:54:42.748 INFO Smtp(1)[1] Response: 250 CHUNKING
2012-07-12 17:54:42.748 ERROR Smtp(1)[1] Info: Rebex.Net.SmtpException: None of the supported authentication methods is accepted by the server.
   at Rebex.Net.Smtp.Login(String userName, String password, SmtpAuthentication method)

1 Answer

0 votes
by (148k points)
edited
 
Best answer

The log indicates that the server doesn't accept any authentication method. Please try removing the Login line:

smtp.Login("testA@xxx.local", "xxxx");

Does it work when this is commented out?

It's possible that .NET SmtpClient simply skips authentication in this case (to test that, try removing the 'smtpClient.Credentials = ...' line), which would explain why it works.

by (170 points)
edited

Indeed it was the "problem"

It seems the standard .NET classes completely ignore the credentials in this case ...

Thank you for the help!

...