Solved

NMPOP3 question

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

Independent Software Vendors: 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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

734 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