Mailkit: Is this the right way to use Proxy Support?

Created on 10 Mar 2019  路  3Comments  路  Source: jstedfast/MailKit

So I'm trying to connect via A sock5 port into imap Client. I cant set UserName I get NullReference.
The current example is with example links none are real host etc..

using (var client = new ImapClient())
{
    client.ProxyClient = new Socks5Client("host", 88);
   client.ProxyClient.ProxyCredentials.UserName = "username";
   client.ProxyClient.ProxyCredentials.Password = "password";

   client.ProxyClient.Connect("imap.example.com", 9951);
   client.Authenticate("mail", "passowrd");
}
question

Most helpful comment

Yes, it is the same for all clients.

All 3 comments

No.

using (var client = new ImapClient ()) {
    var credentials = new NetworkCredential ("username", "password");
    client.ProxyClient = new Socks5Client ("host", 88, credentials);
    client.Connect ("imap.example.com", 995, SecureSocketOptions.SslOnConnect);
    client.Authenticate ("username", "password");
}

Hello Jeffrey,

is it the same approach for smtp client please?

Thanks.

Yes, it is the same for all clients.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anmolk171 picture anmolk171  路  7Comments

ghost picture ghost  路  3Comments

portal7 picture portal7  路  3Comments

TysonMN picture TysonMN  路  5Comments

rgmills picture rgmills  路  6Comments