Solved

NMPOP3 question

Posted on 2001-08-30
4
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month7 days, 14 hours left to enroll

632 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