SmtpServer.SocksProxyServer Property


Gets or sets the socks4/5/http proxy server address (IP or internet domain name).

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

Property Value

A string value indicating the proxy server address (IP address or internet domain).

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.

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()
    Dim oMail As SmtpMail = New SmtpMail("TryIt")
    Dim oSmtp As SmtpClient = New SmtpClient

    Try
        Dim oServer As SmtpServer = New SmtpServer("smtp.adminsystem.com")
        
        oServer.SocksProxyServer = "192.168.0.1"
        oServer.SocksProxyPort = 1080
        ' if your proxy server doesn't requires user authentication, please don't assign any value to 
        ' SocksProxyUser and SocksProxyPassword properties 
        oServer.SocksProxyUser = "tester"
        oServer.SocksProxyPassword = "pass"
        oServer.ProxyProtocol = SocksProxyProtocol.Socks5 
            
        
        'set user authentication
        'oServer.UserName = "myuser@adminsystem.com"
        'oServer.Password = "mypassword"
        
        'specifies the authentication mechanism.
        'oSmtp.AuthType = SmtpAuthType.AuthAuto
        
        'set SSL connection
        'oServer.ConnectType = SmtpConnectType.ConnectSSLAuto
        
        'set smtp server port
        'oServer.Port = 465
        
        'set helo domain
        'oServer.HeloDomain = "mymachine.com"
        
        'set delivery-report address
        'oServer.MailFrom = "report@adminsystem.com"
        
        
        oMail.From = New MailAddress("from@adminsystem.com")
        oMail.To.Add(New MailAddress("to@adminsystem.com"))
        
        oMail.Subject = "test subject"
        oMail.TextBody = "test body"
                       
        oSmtp.SendMail( oServer, oMail )
        Console.WriteLine( "message was sent" )
        
    Catch exp As SmtpTerminatedException
        Console.WriteLine(exp.Message)
    Catch exp As SmtpServerException
        Console.WriteLine("Exception: Server Respond: {0}", exp.ErrorMessage)
    Catch exp As System.Net.Sockets.SocketException
        Console.WriteLine("Exception: Networking Error: {0} {1}", exp.ErrorCode, exp.Message)
    Catch exp As System.ComponentModel.Win32Exception
        Console.WriteLine("Exception: System Error: {0} {1}", exp.ErrorCode, exp.Message)
    Catch exp As System.Exception
        Console.WriteLine("Exception: Common: {0}", exp.Message)
    End Try

End Sub

[C# - Send Email via Socks4, Socks5, HTTP Proxy Server]
using System;
using EASendMail;
void SendMail()
{
    SmtpMail oMail = new SmtpMail("TryIt");
    SmtpClient oSmtp = new SmtpClient();

    try
    {
        SmtpServer oServer = new SmtpServer("smtp.adminsystem.com");
        
        oServer.SocksProxyServer = "192.168.0.1";
        oServer.SocksProxyPort = 1080;
        // if your proxy doesn't requires user authentication, please don't assign any value to 
        // SocksProxyUser and SocksProxyPassword properties 
        oServer.SocksProxyUser = "tester";
        oServer.SocksProxyPassword = "pass";
        oServer.ProxyProtocol = SocksProxyProtocol.Socks5;
        
        
        //set user authentication
        //oServer.UserName = "myuser@adminsystem.com";
        //oServer.Password = "mypassword";
        
        //specifies the authentication mechanism.
        //oSmtp.AuthType = SmtpAuthType.AuthAuto;
        
        //set SSL connection
        //oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
        
        //set smtp server port
        //oServer.Port = 465;
        
        //set helo domain
        //oServer.HeloDomain = "mymachine.com";
        
        //set delivery-report address
        //oServer.MailFrom = "report@adminsystem.com";
        
                
        oMail.From = new MailAddress("from@adminsystem.com" );
        oMail.To.Add( new MailAddress("to@adminsystem.com" ));
        oMail.Subject = "test subject";
        oMail.TextBody = "test body";
                
        oSmtp.SendMail( oServer, oMail );
        Console.WriteLine( "message was sent" );
    }
    catch( SmtpTerminatedException exp )
    {
        Console.WriteLine( exp.Message );
    }
    catch( SmtpServerException exp )
    {
        Console.WriteLine( "Exception: Server Respond: {0}", exp.ErrorMessage );
    }
    catch( System.Net.Sockets.SocketException exp )
    {
        Console.WriteLine( "Exception: Networking Error: {0} {1}", exp.ErrorCode, exp.Message );
    }
    catch( System.ComponentModel.Win32Exception exp )
    {
        Console.WriteLine( "Exception: System Error: {0} {1}", exp.ErrorCode, exp.Message );            
    }
    catch( System.Exception exp )
    {
        Console.WriteLine( "Exception: Common: {0}", exp.Message );         
    }
}
        
[C++/CLI - Send Email via Socks4, Socks5, HTTP Proxy Server]
using namespace System;
using namespace EASendMail;
void SendMail()
{
    SmtpMail ^oMail = gcnew SmtpMail("TryIt");
    SmtpClient ^oSmtp = gcnew SmtpClient();

    try
    {
        SmtpServer ^oServer = gcnew SmtpServer("smtp.adminsystem.com");
        
        oServer->SocksProxyServer = "192.168.0.1";
        oServer->SocksProxyPort = 1080;
        // if your proxy doesn't requires user authentication, please don't assign any value to 
        // SocksProxyUser and SocksProxyPassword properties 
        oServer->SocksProxyUser = "tester";
        oServer->SocksProxyPassword = "pas";
        oServer->ProxyProtocol = SocksProxyProtocol::Socks5;
        
        
        //set user authentication
        //oServer->UserName = "myuser@adminsystem.com";
        //oServer->Password = "mypassword";
        
        //specifies the authentication mechanism.
        //oSmtp->AuthType = SmtpAuthType::AuthAuto;
        
        //set SSL connection
        //oServer->ConnectType = SmtpConnectType::ConnectSSLAuto;
        
        //set smtp server port
        //oServer->Port = 465;
        
        //set helo domain
        //oServer->HeloDomain = "mymachine.com";
        
        //set delivery-report address
        //oServer->MailFrom = "report@adminsystem.com";
                    
        oMail->From = gcnew MailAddress("from@adminsystem.com" );
        oMail->To->Add( gcnew MailAddress("to@adminsystem.com" ));
        oMail->Subject = "test subject";
        oMail->TextBody = "test body";
        
        oSmtp->SendMail( oServer, oMail );
        Console::WriteLine( "message was sent" );
    }
    catch( EASendMail::SmtpTerminatedException ^exp )
    {
        Console::WriteLine( exp->Message );
    }
    catch( EASendMail::SmtpServerException ^exp )
    {
        Console::WriteLine( "Exception: Server Respond: {0}", exp->ErrorMessage );
    }
    catch( System::Net::Sockets::SocketException ^exp )
    {
        Console::WriteLine( "Exception: Networking Error: {0} {1}", exp->ErrorCode.ToString("d"), exp->Message );
    }
    catch( System::ComponentModel::Win32Exception ^exp )
    {
        Console::WriteLine( "Exception: System Error: {0} {1}", exp->ErrorCode.ToString("d"), exp->Message );           
    }
    catch( System::Exception ^exp )
    {
        Console::WriteLine( "Exception: Common: {0}", exp->Message );           
    }
}

See Also

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