Solved

NMPOP3 question

Posted on 2001-08-30
4
236 Views
Last Modified: 2010-04-06
How can I know when I have received a new mail item to my exchange server via NMpop3 component? I can connect ok, I need some sort of a message to know when I received a new mail.

Thanks
0
Comment
Question by:drnadeem
  • 2
4 Comments
 
LVL 1

Expert Comment

by:Phoenix_s
ID: 6446278
check the server every X minutes using a timer

I believe that's how most mail clients do it

it'll tell you if you have new mail
0
 
LVL 1

Expert Comment

by:DelRunner
ID: 6504044
There ar several ways to check this, but a simple one is to store the number of messages in your mailbox everytime you connect, and then compare with the number of messages at the previous connection.
Edit1.Text holds the previous number of mails

procedure TForm1.Button1Click(Sender: TObject);
var
  mails : Integer;

begin
  NMPOP31.Connect;
  mails:=0;
  if NMPOP31.Connected then
  begin
    NMPOP31.List;
    mails:=mails+1;
  end;
  if mails > StrToInt(Edit1.Text) then
    ShowMessage('You got new mail');
  Edit1.Text:=IntToStr(mails);
  MNPOP31.Disconnect;
end;



The best way is the store and compare the MessageId's
0
 
LVL 1

Accepted Solution

by:
DelRunner earned 100 total points
ID: 6512596
..sorry, I found an error in my sample code.
Here's the right one:

var
  Form1: TForm1;
  mails : Integer;

implementation

{$R *.dfm}


procedure TForm1.Button1Click(Sender: TObject);
begin
  NMPOP31.Connect;
  mails:=0;
  if NMPOP31.Connected then
  begin
    NMPOP31.List;
 end;
 if mails > StrToInt(Edit1.Text) then
   ShowMessage('You got new mail');
 Edit1.Text:=IntToStr(mails);
 NMPOP31.Disconnect;
end;

procedure TForm1.NMPOP31List(Msg, Size: Integer);
begin
  mails:=mails+1;
end;
0
 
LVL 1

Author Comment

by:drnadeem
ID: 6539609
sorry for the late reply... but I as away on holidaying :)-
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now