MailServer.ProxyProtocol Property


Gets or sets the protocol (socks4/5/http) for proxy server.

[Visual Basic]
Public Property ProxyProtocol As SocksProxyProtocol
[C#]
public SocksProxyProtocol ProxyProtocol {get; set;}
[C++]
public: __property SocksProxyProtocol get_ProxyProtocol();
public: __property void set_ProxyProtocol(SocksProxyProtocol);
[JScript]
public function get ProxyProtocol() : SocksProxyProtocol;
public function set ProxyProtocol(SocksProxyProtocol);

Property Value

One of SocksProxyProtocol values.

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++] The following example demonstrates how to receive email with EAGetMail POP3 & IMAP Component, but it doesn't demonstrates the events and mail parsing usage. To get the full samples of EAGetMail, please refer to Samples section.

[Visual Basic]
Imports EAGetMail

Public Sub ReceiveMail( _
ByVal sServer As String, _
ByVal sUserName As String, _
ByVal sPassword As String, _
ByVal bSSLConnection As Boolean)
    Dim oClient As New MailClient("TryIt")
    
    Dim oServer As New MailServer(sServer, _
        sUserName, sPassword, bSSLConnection, _
        ServerAuthType.AuthLogin, ServerProtocol.Pop3)

    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 

    Try
        oClient.Connect(oServer)
        Dim infos() As MailInfo = oClient.GetMailInfos()
        Dim count As Integer = infos.Length
        For i As Integer = 0 To count - 1
            Dim info As MailInfo = infos(i)
            Dim oMail As Mail = oClient.GetMail(info)
            ''Save mail to local    file
            oMail.SaveAs(String.Format("c:\{0}.eml", i), True)
        Next

        For i As Integer = 0 To count - 1
            Dim info As MailInfo = infos(i)
            oClient.Delete(info)
        Next
        '
        ' Delete method just mark the email as deleted, 
        ' Quit method pure the emails from server exactly.
        oClient.Quit()

    Catch ep As MailServerException
        ''Message contains the information returned by mail server
        Console.WriteLine("Server Respond: {0}", ep.Message)
    Catch ep As System.Net.Sockets.SocketException
        Console.WriteLine("Socket Error: {0}", ep.Message)
    Catch ep As Exception
        Console.WriteLine("System Error: {0}", ep.Message)
    End Try

    oClient.Close()
End Sub

[C#]
using System;
using System.Collections;
using EAGetMail;

public void ReceiveMail( 
    string sServer, 
    string sUserName,
    string sPassword,
    bool bSSLConnection)
{
    MailClient oClient = new MailClient("TryIt");

    MailServer oServer  = new MailServer(sServer, 
        sUserName, sPassword, bSSLConnection, 
        ServerAuthType.AuthLogin, ServerProtocol.Pop3);

    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;
    try
    {
        oClient.Connect(oServer);
        MailInfo [] infos = oClient.GetMailInfos();
        int count = infos.Length;
        for( int i = 0; i < count; i++ )
        {
            MailInfo info = infos[i];
            Mail oMail = oClient.GetMail(info);
            //Save mail to local file
            oMail.SaveAs(String.Format("c:\\{0}.eml", i), true);
        }

        for( int i = 0; i < count; i++ )
        {
            MailInfo info = infos[i];
            oClient.Delete(info);
        }
    
        // Delete method just mark the email as deleted, 
        // Quit method pure the emails from server exactly.
        oClient.Quit();
    }
    catch( MailServerException ep ) 
    {
        //Message contains the information returned by mail server
        Console.WriteLine("Server Respond: {0}", ep.Message);
    }
    catch( System.Net.Sockets.SocketException ep ) 
    {
        Console.WriteLine("Socket Error: {0}", ep.Message);
    }
    catch( Exception ep ) 
    {
        Console.WriteLine("System Error: {0}", ep.Message);
    }

    oClient.Close();
}

[C++]
using namespace System;
using namespace System::Collections;
using namespace EAGetMail; 

Void ReceiveMail( 
        String *sServer, 
        String *sUserName,
        String *sPassword,
        bool bSSLConnection)
{
    MailClient *oClient = new MailClient(S"TryIt");
 
    MailServer *oServer  = new MailServer(sServer, 
        sUserName, sPassword, bSSLConnection, 
        ServerAuthType::AuthLogin, ServerProtocol::Pop3);

    oServer->SocksProxyServer = S"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 = S"tester";
    oServer->SocksProxyPassword = S"pass";
    oServer->ProxyProtocol = SocksProxyProtocol::Socks5;
    try
    {
        oClient->Connect(oServer);
        MailInfo *infos[]= oClient->GetMailInfos();
        int count = infos->Length;
        for( int i = 0; i < count; i++ )
        {
            MailInfo *info = infos[i];
            Mail *oMail = oClient->GetMail(info);
            //Save mail to local file
            oMail->SaveAs(String::Format(S"c:\\{0}.eml", __box(i)), true);
        }

        for( int i = 0; i < count; i++ )
        {
            MailInfo *info = infos[i];
            oClient->Delete(info);
        }
    
        // Delete method just mark the email as deleted, 
        // Quit method pure the emails from server exactly.
        oClient->Quit();
    }
    catch( MailServerException *ep ) 
    {
        //Message contains the information returned by mail server
        Console::WriteLine( S"Server Respond: {0}", ep->Message);
    }
    catch( System::Net::Sockets::SocketException *ep ) 
    {
        Console::WriteLine( S"Socket Error: {0}", ep->Message);
    }
    catch( Exception *ep ) 
    {
        Console::WriteLine( S"System Error: {0}", ep->Message);
    }

    oClient->Close();
}