Pop3Server Property

This property represents a pop3 server address in domain or ip address.


Data Type: String

Remarks

Pop3Request object and Pop3Queue object enables ASP/ASP.NET application to retrieve email in background. Suppose that there are many emails in specified pop3 mailbox, if your ASP/ASP.NET application retrieve all emails in this mailbox directly, it would take a long time which may cause ASP/ASP.NET timeout. User could get a response from the application until the task is finished.

How does Pop3Queue work?

Firstly, an ASP/ASP.NET application collects pop3 account information and builds a new Pop3Request object based on specified pop3 account. Secondly, it sends this Pop3Request object to local/remote application which runs in background. Finally, the application return to the user and the server application performs task in background.

Usage Example

[ASP/VBScript]
[client application]
This subroutine demonstrates how to send a request to background application.
Sub SendRequest
  Dim oPop3Request, oPop3Queue
  Dim pop3Server, user, password, appAddr, port 
  
  appAddr = "127.0.0.1"
  port = 5157

  pop3Server = "mail.adminsystem.net"
  user = "test@adminsystem.net"
  password = "test"

  Set oPop3Request = Server.CreateObject("ANPOP.Pop3Request")
  Set oPop3Queue = Server.CreateObject("ANPOP.Pop3Queue" )

  oPop3Request.Pop3Server = pop3Server
  oPop3Request.UserName = user
  oPop3Request.Password = password
  oPop3Request.LFlag = 1 'any numeric value which associated with this request
  oPop3Request.SFlag = "any" 'any string value which assocatied with this request

  If oPop3Queue.SendRequest( appAddr, port, oPop3Request ) = 0 Then
    Response.Write "send request succeeded"
  Else
    Response.Write "send request failed, "
  End 
End Sub

[background application]
This subroutine demonstrates how to receive a request from ASP/ASP.NET.
Sub Receive
  Dim oPop3Queue As ANPOPLib.Pop3Queue
  Dim oPop3Reqest As ANPOPLib.Pop3Request
  Dim MaxConnections, Port As Integer
  
  MaxConnections = 5
  Port = 5157
  Set oPop3Queue = new ANPOPLib.Pop3Queue
  If oPop3Queue.Listen( Port, MaxConnections ) <> 0 Then
	MsgBox "bind port failed"
	Exit Sub
  End If
  
  Do While True
	Set oPop3Request = oPop3Queue.Receive(1)
	If Not (oPop3Request Is Nothing) Then
      'now a request received, then use another subroutine to retrieve email 
      Call RetrieveEmail( oPop3Request.Pop3Server, _
		                oPop3Request.UserName, _ 
		                oPop3Request.Password )
	End If
	Nothing received
	DoEvents
  Loop
End Sub
[ASP.NET/C#]
[client application]
This subroutine demonstrates how to send a request to background application.
public void SendRequest()
{
  string pop3Server = "mail.adminsystem.net";
  string user = "test@adminsystem.net";
  string password = "test";
  string appAddr = "127.0.0.1";
  int port = 5157;
  
  pop3RequestClass oPop3Request =
                      (pop3RequestClass)Server.CreateObject("ANPOP.Pop3Request");
  Pop3QueueClass oPop3Queue = 
                      (Pop3QueueClass)Server.CreateObject("ANPOP.Pop3Queue");
  
  oPop3Request.Pop3Server = pop3Server;
  oPop3Request.UserName = user;
  oPop3Request.Password = password;
  oPop3Request.LFlag = 1; //any numeric value associated with this request
  oPop3Request.SFlag = "any"; //any string value associated with this request
 
  if( oPop3Queue.SendRequest( appAddr, port, oPop3Request ) == 0 )
    Response.Write( "send request succeeded");
  else
    Response.Write( "send request failed, " );
 
 }
 
[background application]
This subroutine demonstrates how to receive a request from ASP/ASP.NET.
public void Receive()
{
  pop3RequestClass oPop3Request = null;
  Pop3QueueClass oPop3Queue = new Pop3QueueClass();
  int MaxConnections = 5, Port = 5157;
  
  if( oPop3Queue.Listen( Port, MaxConnections ) != 0 )
    throw new Exception( "bind 5157 port failed" );
  
  while( true )
  {
    oPop3Request = oPop3Queue.Receive(1);
    if( oPop3Request != null )
    {
      //now a request received, then use another subroutine to retrieve email 
      RetrieveEmail( oPop3Request.Pop3Server,
		                oPop3Request.UserName, 
		                oPop3Request.Password );      
    }
    else
      Thread.Sleep(10); //nothing received, sleep sometime
  }
}

2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.