SmtpServer.SocksProxyUser Property


Gets or sets the user for proxy user authentication.

[Visual Basic]
Public Property SocksProxyUser As String
[C#]
public string SocksProxyUser {get; set;}
[C++]
public: __property String^ get_SocksProxyUser();
public: __property void set_SocksProxyUser(String^);
[JScript]
public function get SocksProxyUser() : String;
public function set SocksProxyUser(String);

Property Value

A string value indicating the user for proxy user authentication.

Remarks

If SocksProxyServer is not specified, the direct connection will be used; otherwise the proxy connection will be used. We don't suggest that you use the proxy server except it is your only choice.

Example

[Visual Basic, C#, C++] To get the full samples of EASendMail, please refer to Samples section.

[VB - Send Email via Socks4, Socks5, HTTP Proxy Server]

Imports EASendMail

Sub SendMail()

    Try
        Dim oServer As SmtpServer = New SmtpServer("smtp.adminsystem.com")

        ' proxy server address, port and protocol
        oServer.SocksProxyServer = "192.168.0.1"
        oServer.SocksProxyPort = 1080
        oServer.ProxyProtocol = SocksProxyProtocol.Socks5

        ' if your proxy server doesn't requires user authentication,
        ' don't assign any value to SocksProxyUser and SocksProxyPassword properties 
        oServer.SocksProxyUser = "tester"
        oServer.SocksProxyPassword = "pass"

        ' set user authentication
        oServer.User = "myuser@adminsystem.com"
        oServer.Password = "mypassword"

        ' specifies the authentication mechanism, AuthAuto is default value
        ' oSmtp.AuthType = SmtpAuthType.AuthAuto

        ' Most mordern SMTP servers require SSL/TLS connection now.
        ' ConnectTryTLS means if server supports SSL/TLS, SSL/TLS will be used automatically.
        oServer.ConnectType = SmtpConnectType.ConnectTryTLS
        
        ' set SSL/TLS connection
        ' oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
        
        ' set SMTP server port to 587, default value is 25
        ' oServer.Port = 587

        ' set SMTP server port to 465, 
        ' if 465 port is used, ConnectType should use ConnectSSLAuto or ConnectDirectSSL.
        ' oServer.Port = 465
        
        ' set helo domain, default value is current machine name
        ' oServer.HeloDomain = "mymachine.com"
        
        Dim oMail As SmtpMail = New SmtpMail("TryIt")
        oMail.From = New MailAddress("from@adminsystem.com")
        oMail.To.Add(New MailAddress("to@adminsystem.com"))
        
        oMail.Subject = "test email sent from VB"
        oMail.TextBody = "test body"
                        
        Dim oSmtp As SmtpClient = New SmtpClient()
        oSmtp.SendMail(oServer, oMail)
        Console.WriteLine("This email has been submitted to server successfully!")

    Catch exp As Exception
        Console.WriteLine("Exception: {0}", exp.Message)
    End Try

End Sub


[C# - Send Email via Socks4, Socks5, HTTP Proxy Server] using System; using EASendMail; void SendMail() { try { // SMTP server address SmtpServer oServer = new SmtpServer("smtp.adminsystem.com"); // proxy server address, port and protocol oServer.SocksProxyServer = "192.168.0.1"; oServer.SocksProxyPort = 1080; oServer.ProxyProtocol = SocksProxyProtocol.Socks5; // if your proxy doesn't requires user authentication, // don't assign any value to SocksProxyUser and SocksProxyPassword properties oServer.SocksProxyUser = "tester"; oServer.SocksProxyPassword = "pass"; // SMTP user authentication oServer.User = "myusername"; oServer.Password = "mypassword"; // specifies the authentication mechanism, AuthAuto is default value // oSmtp.AuthType = SmtpAuthType.AuthAuto; // Most mordern SMTP servers require SSL/TLS connection now. // ConnectTryTLS means if server supports SSL/TLS, SSL/TLS will be used automatically. oServer.ConnectType = SmtpConnectType.ConnectTryTLS; // set SSL/TLS connection // oServer.ConnectType = SmtpConnectType.ConnectSSLAuto; // set SMTP server port to 587, default value is 25 // oServer.Port = 587; // set SMTP server port to 465, // if 465 port is used, ConnectType should use ConnectSSLAuto or ConnectDirectSSL. // oServer.Port = 465; // set helo domain, default value is current machine name // oServer.HeloDomain = "mymachine.com"; SmtpMail oMail = new SmtpMail("TryIt"); oMail.From = new MailAddress("from@adminsystem.com"); oMail.To.Add(new MailAddress("to@adminsystem.com")); oMail.Subject = "test email sent from C#"; oMail.TextBody = "test body"; SmtpClient oSmtp = new SmtpClient(); oSmtp.SendMail(oServer, oMail); Console.WriteLine("This email has been submitted to server successfully!"); } catch(Exception exp) { Console.WriteLine("Exception: {0}", exp.Message); } }
[C++/CLI - Send Email via Socks4, Socks5, HTTP Proxy Server] using namespace System; using namespace EASendMail; void SendMail() { try { // SMTP server address SmtpServer ^oServer = gcnew SmtpServer("smtp.adminsystem.com"); // proxy server address, port and protocol oServer->SocksProxyServer = "192.168.0.1"; oServer->SocksProxyPort = 1080; oServer->ProxyProtocol = SocksProxyProtocol::Socks5; // if your proxy doesn't requires user authentication, // don't assign any value to SocksProxyUser and SocksProxyPassword properties oServer->SocksProxyUser = "tester"; oServer->SocksProxyPassword = "pass"; // SMTP user authentication oServer->User = "myusername"; oServer->Password = "mypassword"; // specifies the authentication mechanism, AuthAuto is default value // oSmtp.AuthType = SmtpAuthType::AuthAuto; // Most mordern SMTP servers require SSL/TLS connection now. // ConnectTryTLS means if server supports SSL/TLS, SSL/TLS will be used automatically. oServer->ConnectType = SmtpConnectType::ConnectTryTLS; // set SSL/TLS connection // oServer->ConnectType = SmtpConnectType::ConnectSSLAuto; // set SMTP server port to 587, default value is 25 // oServer->Port = 587; // set SMTP server port to 465, // if 465 port is used, ConnectType should use ConnectSSLAuto or ConnectDirectSSL. // oServer->Port = 465; // set helo domain, default value is current machine name // oServer->HeloDomain = "mymachine.com"; SmtpMail ^oMail = gcnew SmtpMail("TryIt"); oMail->From = gcnew MailAddress("from@adminsystem.com"); oMail->To->Add(gcnew MailAddress("to@adminsystem.com")); oMail->Subject = "test email sent from C++/CLI"; oMail->TextBody = "test body"; SmtpClient ^oSmtp = gcnew SmtpClient(); oSmtp->SendMail(oServer, oMail); Console::WriteLine("This email has been submitted to server successfully!"); } catch(Exception ^exp) { Console::WriteLine("Exception: {0}", exp->Message); } }

See Also

Bulk Email Sender Guidelines
SmtpServer.ProxyProtocol Property
SmtpServer.SocksProxyServer Property
SmtpServer.SocksProxyPort Property
SmtpServer.SocksProxyPassword Property