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)

asked 12 Jul '12, 17:45

Fabrice's gravatar image

Fabrice
274
accept rate: 0%

edited 12 Jul '12, 18:10


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.

link

answered 12 Jul '12, 23:13

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
3.3k28
accept rate: 29%

Indeed it was the "problem"

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

Thank you for the help!

(13 Jul '12, 00:13) Fabrice
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×15
×6

Asked: 12 Jul '12, 17:45

Seen: 1,475 times

Last updated: 13 Jul '12, 00:13