 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jeff Guest
|
Posted: Mon Oct 10, 2005 10:41 pm Post subject: retrieving mail |
|
|
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 |
|
| Back to top |
|
 |
Jamie Guest
|
Posted: Tue Oct 11, 2005 8:11 am Post subject: Re: retrieving mail |
|
|
Jeff wrote:
| Quote: | 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
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 |
|
| Back to top |
|
 |
Bruce Roberts Guest
|
Posted: Thu Oct 13, 2005 4:18 am Post subject: Re: retrieving mail |
|
|
"Jeff" <ffej2ffej (AT) dslextreme (DOT) com> wrote in message
news:11kldfchfka89ee (AT) corp (DOT) supernews.com...
| Quote: | 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} );
| Quote: | 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.) |
|
| Back to top |
|
 |
Fumio Kawamata Guest
|
Posted: Thu Oct 13, 2005 5:56 pm Post subject: Re: retrieving mail |
|
|
Jeff wrote:
| Quote: | 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 fumio (AT) my (DOT) email.ne.jp |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|