0 votes
by (8.6k points)
edited

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

+1 vote
by (58.9k points)
edited
 
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();
...