BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

retrieving mail

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.components.usage
View previous topic :: View next topic  
Author Message
Jeff
Guest





PostPosted: Mon Oct 10, 2005 6:41 pm    Post subject: retrieving mail Reply with 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



Back to top
Jamie
Guest





PostPosted: Tue Oct 11, 2005 4:11 am    Post subject: Re: retrieving mail Reply with quote



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





PostPosted: Thu Oct 13, 2005 12:18 am    Post subject: Re: retrieving mail Reply with quote




"Jeff" <ffej2ffej (AT) dslextreme (DOT) com> 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 }

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





PostPosted: Thu Oct 13, 2005 1:56 pm    Post subject: Re: retrieving mail Reply with quote

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:indyprotocolsidPOP3.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 [email]fumio (AT) my (DOT) email.ne.jp[/email]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.components.usage All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.