Click or drag to resize
MimeKit

Socks5Client Class

A SOCKS5 proxy client.
Inheritance Hierarchy
SystemObject
  MailKit.Net.ProxyProxyClient
    MailKit.Net.ProxySocksClient
      MailKit.Net.ProxySocks5Client

Namespace: MailKit.Net.Proxy
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public class Socks5Client : SocksClient

The Socks5Client type exposes the following members.

Constructors
 NameDescription
Public methodCode exampleSocks5Client(String, Int32) Initializes a new instance of the Socks5Client class.
Public methodCode exampleSocks5Client(String, Int32, NetworkCredential) Initializes a new instance of the Socks5Client class.
Top
Properties
 NameDescription
Public propertyLocalEndPoint Get or set the local IP end point to use when connecting to a remote host.
(Inherited from ProxyClient)
Public propertyProxyCredentials Gets the proxy credentials.
(Inherited from ProxyClient)
Public propertyProxyHost Get the proxy host.
(Inherited from ProxyClient)
Public propertyProxyPort Get the proxy port.
(Inherited from ProxyClient)
Public propertySocksVersion Get the SOCKS protocol version.
(Inherited from SocksClient)
Top
Methods
 NameDescription
Public methodConnect(String, Int32, CancellationToken) Connect to the target host.
(Overrides ProxyClientConnect(String, Int32, CancellationToken))
Public methodConnect(String, Int32, Int32, CancellationToken) Connect to the target host.
(Inherited from ProxyClient)
Public methodConnectAsync(String, Int32, CancellationToken) Asynchronously connect to the target host.
(Overrides ProxyClientConnectAsync(String, Int32, CancellationToken))
Public methodConnectAsync(String, Int32, Int32, CancellationToken) Asynchronously connect to the target host.
(Inherited from ProxyClient)
Public methodEquals
(Inherited from Object)
Protected methodFinalize
(Inherited from Object)
Public methodGetHashCode
(Inherited from Object)
Public methodGetType
(Inherited from Object)
Protected methodMemberwiseClone
(Inherited from Object)
Public methodToString
(Inherited from Object)
Top
Remarks
A SOCKS5 proxy client.
Example
C#
public static void SendMessageViaProxy (MimeMessage message)
{
    using (var client = new SmtpClient ()) {
        client.ProxyClient = new Socks5Proxy ("socks5.proxy.com", 1080, new NetworkCredentials ("proxyUserName", "proxyPassword"));
        client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);
        client.Authenticate ("username", "password");

        client.Send (message);

        client.Disconnect (true);
    }
}
See Also