0 votes

I want full example of IMAP.LoginSSPI method with all the parameters.

by

1 Answer

0 votes
using(Imap client = new Imap())
{
    client.ConnectSSL("imap.example.com");
    client.LoginSSPI(SSPIMechanism.NTLM, 
        "domain/user", "password",  "imap/" + "imap.example.com");


    client.Close()
}

or simply:

using(Imap client = new Imap())
{
    client.ConnectSSL("imap.example.com");
    client.LoginSSPI(SSPIMechanism.Negotiate);


    client.Close()
}
by (297k points)
i am trying with gmail account.

using(Imap client = new Imap())
{    //abc@gmail.com
    client.ConnectSSL("imap.gmail.com");
    client.LoginSSPI(Limilabs.Client.Authentication.SSPIMechanism.Negotiate,"gmail.com/abc", "password", "imap/" + "imap.gmail.com");
    client.Close();
}

but it shows following error
Additional information: Unsupported AUTHENTICATE mechanism. rz3mb59946548pbc
it doesn't work. Please advice me.
Please don't use several accounts on this forum - we can see your IP address.

"Unsupported AUTHENTICATE mechanism" error means exactly that - this authentication mechanism is not supported by your server. This error is returned by your server, not Mail.dll.

You can use SupportedAuthenticationMethods() method to list all methods supported by your server:
https://www.limilabs.com/blog/get-supported-authentication-methods-imap-pop3-smtp

You should be using UseBestLogin("user","pass") method unless you need to use specific authentication mechanism.
Thanks you.
I need to login by IMAP.LoginOAUTH2(String user, String AccessToken). I have referred some examples of limilabs.
Can I get accessToken programmatically?
LoginOAUTH2 has nothing to do with SSPI. Take a look at the samples:
https://www.limilabs.com/mail/samples#imap-gmail-oauth2
https://www.limilabs.com/mail/samples#imap-outlook-oauth2
There are OAuth 2.0 tutorials for Gmail and Outlook.com there. Entire process is described there in detail.
Ok. I want to provide Authentication Type for IMAP and SMTP like "Kerberos", "NTLM".

I have tried by LoginSSPI but most server doesn't support "Kerberos", "NTLM".

How can I provide this facility? Please suggest me way.
If the server doesn't support it. You can not use it.
...