This is what I've written so far.
program mailheader;
{$APPTYPE CONSOLE}
uses
SysUtils, NMPOP3;
var
mailretriever : TNMPOP3;
begin
{ TODO -oUser -cConsole Main : Insert code here }
mailretriever.UserID := 'ffej2ffej';
mailretriever.Password := '****'; (* change this before using it *)
mailretriever.Host := 'mail.dslextreme.com';
mailretriever.Connect;
end.
When I compile it, Delphi says my mailretriever component may not be
initialized. When I step through it, it goes to the first line after begin
(mailretriever.UserID := 'ffej2ffej'; and does nothing. I don't even know
if it runs that first line. No matter what, it keeps going back to that
first line and won't do anything else.
I'm wondering about several subjects:
Is this the proper way to include a TNMPOP3 component in a non-form
application?
Should I be calling the TNMPOP3 constructor? (aka the Create method)?
If I do call the Create method, what should I put as the owner? I'm trying
to tell it to be owned by the program, but if I say
mailretriever.Create(mailheader) it has no idea what I mean.
Thank you for your help
at least you will need a message loop..
you may want to try the ICS components instead.
i do think they create their own window.
but still, i think a message loop maybe required.
--
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
> I'm wondering about several subjects:
> Is this the proper way to include a TNMPOP3 component in a non-form
> application?
> Should I be calling the TNMPOP3 constructor? (aka the Create method)?
Yes.
I'm not familiar with the tNMPop3 type. However, if it is a component then
you need to create an instance before actually using it. Simply declaring
storage to reference the instance is not enough. You probably need
something like
mailRetriever := tNMPop3.Create ( {perhaps some parameters} );
> If I do call the Create method, what should I put as the owner? I'm
> trying
> to tell it to be owned by the program, but if I say
> mailretriever.Create(mailheader) it has no idea what I mean.
Ah. Owner is generally the form on which you've dropped the control at
design time. You might try Nil for Owner. (You'll have to remember to use
Free to release the control.)
I have written the console program which remove the unexpected
e-mails from the POP server. I used IdPOP3 instead of the NMPOP3.
I will show you a part of the source code.
uses
SysUtils, Classes, Windows,
IdPOP3 in 'c:\indy\protocols\idPOP3.pas',
...
var
POP3: TIdPOP3;
...
begin
...
POP3:=TIdPOP3.Create(Nil);
...
POP3.Free;
...
end.
I hope this will help you.
You can see the project source code (.dpr) at the following url.
http://openlab.jp/fumio/mailutl/src/mailutl.dpr
Regards.
--
Fumio KAWAMATA fu...@my.email.ne.jp