| IProxyClient Interface |
An interface for connecting to services via a proxy.
Namespace: MailKit.Net.ProxyAssembly: MailKit (in MailKit.dll) Version: 4.7.1
Syntax public interface IProxyClient
The IProxyClient type exposes the following members.
Properties Methods | Name | Description |
---|
| 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.
|
TopRemarks Example 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