Mail ServiceProxy Client Property
Get or set the proxy client to use when connecting to a remote host.
Definition
Namespace: MailKit
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
The proxy client.
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public IProxyClient? ProxyClient { get; set; }Property Value
IProxyClientThe proxy client.
Implements
IMailServiceProxyClientRemarks
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 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);
}
}