Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

retrieving mail

10 views
Skip to first unread message

Jeff

unread,
Oct 10, 2005, 2:41:25 PM10/10/05
to
I am trying to make a console program that will retrieve mail from a POP3
server in Delphi 6. The program will get all the necessary paramaters (user
name, password, etc.) in the command line.

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

Jamie

unread,
Oct 11, 2005, 12:11:34 AM10/11/05
to
i don't think that is going to work for you.
the net manager components i do think are ocx type
and thus requires a window..
your going to need a window to handle the messages.

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

Bruce Roberts

unread,
Oct 12, 2005, 8:18:31 PM10/12/05
to

"Jeff" <ffej...@dslextreme.com> wrote in message
news:11kldfc...@corp.supernews.com...

>I am trying to make a console program that will retrieve mail from a POP3
> server in Delphi 6. The program will get all the necessary paramaters
> (user
> name, password, etc.) in the command line.
>
> 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 }

> 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.)


Fumio Kawamata

unread,
Oct 13, 2005, 9:56:36 AM10/13/05
to
Jeff wrote:
> 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.

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

0 new messages