ProxyClient Class

An abstract proxy client base class.

Definition

Namespace: MailKit.Net.Proxy
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public abstract class ProxyClient : IProxyClient
Inheritance
Object    ProxyClient
Derived
Implements
IProxyClient

Remarks

A proxy client can be used to connect to a service through a firewall that would otherwise be blocked.

Example

C#
                    public static void SendMessageViaProxy (MimeMessage message)
{
    using (var client = new SmtpClient ()) {
        client.ProxyClient = new Socks5Client ("socks5.proxy.com", 1080, new NetworkCredential ("proxyUserName", "proxyPassword"));
        client.Connect ("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);
        client.Authenticate ("username", "password");

        client.Send (message);

        client.Disconnect (true);
    }
}
                  

Constructors

ProxyClient(String, Int32) Initializes a new instance of the ProxyClient class.
ProxyClient(String, Int32, NetworkCredential) Initializes a new instance of the ProxyClient class.

Properties

LocalEndPoint Get or set the local IP end point to use when connecting to a remote host.
ProxyCredentials Gets the proxy credentials.
ProxyHost Get the proxy host.
ProxyPort Get the proxy port.
SystemProxy Get a client for the default system proxy.

Methods

Connect(String, Int32, CancellationToken) Connect to the target host.
Connect(String, Int32, Int32, CancellationToken) Connect to the target host.
ConnectAsync(String, Int32, CancellationToken) Asynchronously connect to the target host.
ConnectAsync(String, Int32, Int32, CancellationToken) Asynchronously connect to the target host.
Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetHashCode Serves as the default hash function.
(Inherited from Object)
GetType Gets the Type of the current instance.
(Inherited from Object)
MemberwiseClone Creates a shallow copy of the current Object.
(Inherited from Object)
ToString Returns a string that represents the current object.
(Inherited from Object)

See Also