Click or drag to resize
MimeKit

MailServiceProxyClient Property

Get or set the proxy client to use when connecting to a remote host.

Namespace: MailKit
Assembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax
C#
public IProxyClient ProxyClient { get; set; }

Property Value

IProxyClient
The proxy client.

Implements

IMailServiceProxyClient
Remarks
Gets or sets the proxy client to use when connecting to a remote host via any of the Connect methods.
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