SMTP - none of the supported authentication methods is accepted by the server

0 votes
asked Aug 23, 2013 by Rebex KB (8,240 points)
edited Aug 23, 2013

We currently use Rebex Secure Mail, but are finding that it cannot authenticate to Google Postini for sending mail via SMTP with the simple code:

Smtp smtp = new Smtp();
smtp.Connect("server");
smtp.Login("username", "password");
smtp.Send("from", "to", "subject", "body");
smtp.Disconnect();

The exception we get from the Login method is:

Rebex.Net.SmtpException: None of the supported authentication methods is accepted by the server.

However, when we use the System.Net.Mail.SmtpClient it works without a problem. What can we do with it?

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Aug 23, 2013 by Tomas Knopp (58,890 points)
edited Aug 23, 2013
 
Best answer

Actually, when the standard .NET Smtp client connects to an SMTP server that does not allow any authentication method, it skips authentication (even though credentials were specified) and proceeds directly to sending the mail message. To reproduce the same behavior with Rebex Smtp object, try this:

Smtp smtp = new Smtp();
smtp.Connect("server");

if (smtp.GetSupportedAuthenticationMethods().Length > 0)
{
    smtpClient.Login("username", "password");
}

smtp.Send("from", "to", "subject", "body");
smtp.Disconnect();
...