Solved

NMPOP3 question

Posted on 2001-08-30
4
237 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

16 Experts available now in Live!

Get 1:1 Help Now