Solved

scanning email inbox with nmpop3 in delphi 6

Posted on 2003-11-07
6
571 Views
Last Modified: 2010-04-16
hi there ,
i am having a problem in automating the pop3 email retrival i need to scan every 10 minutes an email inbox with nmpop3 and get the messages sent from someone and save the attachement file into a directory can anybody help me with this.
0
Comment
Question by:fadymoussallem
6 Comments
 
LVL 2

Expert Comment

by:Ray_Adams
ID: 9701086
What problem do you have?
0
 
LVL 17

Accepted Solution

by:
geobul earned 100 total points
ID: 9701664
Hi,

Something like :

procedure TForm1.Timer1Timer(Sender: TObject);
var
  i, j: integer;
  fname: string;
begin
  try
    with NMPOP31 do begin
      if not Connected then Connect;
      if MailCount > 0 then begin
        for i := 1 to MailCount do begin
          GetMailMessage(i);
          if MailMessage.Attachments.Count > 0 then begin
            for j := 0 to MailMessage.Attachments.Count - 1 do begin
               fname := ExtractFileName(MailMessage.Attachments[j]);
               CopyFile(PChar(MailMessage.Attachments[j]), PChar('c:\emails\'+ fname), false); // copy a file
            end;
          end;  
        end;
      end;
    end;
  except
    // error
  end;
end;

Regards, Geo
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9702490
Please, if you have Delphi6, DO NOT use NMPop3. The NetMasters components are notorious
for being buggy and haven;t been updated since 1998. They also do not include sourcecode.
Use Indy (included with D6)  or ICS Instead.
0
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.

 

Author Comment

by:fadymoussallem
ID: 9712784
thank you geobul for your help i am thankful but i am getting always a message fault saying "project raised exception class exception with message "- ERR message 1 has been deleted'
0
 
LVL 17

Expert Comment

by:geobul
ID: 9712980
Where are you getting that error? At what line? BTW, I forgot to call Disconnect at the end of the function.
0
 

Author Comment

by:fadymoussallem
ID: 9713336
thank you very much it worked but i called diconnect at the beginning of the function
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

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…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 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

22 Experts available now in Live!

Get 1:1 Help Now