ANPOP Developers Center > Using ANPOP3 in Delphi with Multiple Threaded

You should download the anpop installer and install it on your machine at first. If you want to distribute or deploy anpop without anpop installer, please click here to learn more.

Add reference of ANPOP to your project

First of all, make sure ANPOP has been installed on your machine. Now start to create a standard delphi project: select menu "Project" -> "Import Type Library", checked "ANPOP POP3 COMPONENT BUILD" and click "Create Unit".

Using Multiple Threading

We inherit a class from TThread to implement worker thread.

unit Unit2;

interface

uses
  Classes, activex, ANPOPLib_TLB;

type
  TPop3Thread = class(TThread)
  public
    procedure CheckEmail( server: string;
                          user: string;
                          password: string;
                          index: Integer );

  protected
    m_server: string;
    m_user: string;
    m_password: string;
    m_status: string;
    m_index: Integer;

    procedure Execute; override;
    procedure UpdateStatus( src: string );
    procedure SyncUpdateStatus();
  end;
					

The following code demonstrates how to use above class to create worker thread and receive email.

    for i:= 0 to nCount-1 do
    begin
      oPop3Th := TPop3Thread.Create(True);
      oPop3Th.FreeOnTerminate := True;
      item := items.Item[i];

      oPop3Th.CheckEmail( item.Caption,
                    item.SubItems[0],
                    item.SubItems[1],
                    i );
      InterlockedIncrement( m_nCurThreads );
    end;

A Total Sample

This sample demonstrates how to receive email with multiple threaded application, click here to download. This sample is developed with Delphi 7.0

Note*: you need to finish the procedure of "TPop3Thread.Execute" in Unit2 to meet your requirement.

Free Email Support

Not enough? Please contact our technical support team.

Support@EmailArchitect.NET
VIP@EmailArchitect.NET(Registered User)

Remarks
We usually reply emails in 24hours. The reason for getting no response is likely that your smtp server bounced our reply. In this case, please try to use another email address to contact us. Your Hotmail or Yahoo email account is recommended.



2001-2010 © Copyright AdminSystem Software Limited. All rights reserved.   About us  Site Map