Socks |
public Socks5Client( string host, int port, NetworkCredential credentials )
Exception | Condition |
---|---|
ArgumentNullException | host is null. -or- credentialsis null. |
ArgumentOutOfRangeException | port is not between 1 and 65535. |
ArgumentException | The host is a zero-length string. -or- The length of host is greater than 255 characters. |
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); } }