Description
Sets the server proxy of this email message.
Applies to
Syntax
smtpclient.SetProxy(string host, long port{, integer proxytype}{, string username , string password})
Argument |
Description |
---|---|
smtpclient |
A SMTP client object identifying the client in which you want to set the server proxy. |
host |
A string that contains the proxy services. When it is set to an empty value, it indicates the server proxy is cancelled. |
port |
A long that contains the services port. |
proxytype (optional) |
Specifies the values of the proxy type. Values are: 0 -- Use SOCKS4 Proxy. 1 -- Use SOCKS4a Proxy. The proxy resolves URL hostname. 2 -- Use SOCKS5 Proxy. 3 -- (Default) Use SOCKS5h Proxy. The proxy resolves URL hostname. |
username (optional) |
A string that contains the services proxy name. |
password (optional) |
A string that contains the services proxy password. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, the method returns null.
Examples
The following example sets the IP address and the port of the proxy.
lnv_SmtpClient.SetProxy("192.168.168.10",8004)
The following example sets the IP address, port, proxy type, user name and password of the proxy.
lnv_SmtpClient.SetProxy("192.168.168.10",8004,5,"proxy-myusername","proxy-mypassword")
The following example cancels the proxy that is set before.
lnv_SmtpClient.SetProxy("",0)
See also