Click or drag to resize
MimeKit

IProxyClient Interface

An interface for connecting to services via a proxy.

Namespace: MailKit.Net.Proxy
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public interface IProxyClient

The IProxyClient type exposes the following members.

Properties
 NameDescription
Public propertyLocalEndPoint Get or set the local IP end point to use when connecting to a remote host.
Public propertyProxyCredentials Gets the proxy credentials.
Public propertyProxyHost Get the proxy host.
Public propertyProxyPort Get the proxy port.
Top
Methods
 NameDescription
Public methodConnect(String, Int32, CancellationToken) Connect to the target host.
Public methodConnect(String, Int32, Int32, CancellationToken) Connect to the target host.
Public methodConnectAsync(String, Int32, CancellationToken) Asynchronously connect to the target host.
Public methodConnectAsync(String, Int32, Int32, CancellationToken) Asynchronously connect to the target host.
Top
Remarks
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