 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Salvatore Besso Guest
|
Posted: Thu Dec 16, 2004 1:08 am Post subject: Is it legal with Indy? |
|
|
hello all,
I was wondering if it is legal, while a POP3 session is in progress, to open,
work with and close SMTP sessions. I'm using Delphi 7 Pro and Indy 9.0.18.
Basically what I'm doing is more or less:
POP3.Connect;
GetMessageCount;
for MsgNo := 0 to Pred(MessagesCount) do
begin
RetrieveHeaders(MsgNo);
POP3.Retrieve(MsgNo, Using_POP3_IdMessage);
Elaborate;
SMTP.Connect;
SendAutoResponse(Using_SMTP_IdMessage);
SMTP.Disconnect;
Copy_POP3_IdMessage_Into_SMTP_IdMessage;
SMTP.Connect;
SendMessageCopy(Using_SMTP_IdMessage);
SMTP.Disconnect;
POP3.Delete(MsgNo)
end;
POP3.Disconnect;
I ask this because I'm still struggling with an error 10053 that happens when
the execution arrives at the POP3.Delete instruction. If it can help, my ISP
POP3 server and SMTP server are the same, but I don't think that it could be a
problem (I hope .
Thank you
Salvatore
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Dec 16, 2004 4:30 am Post subject: Re: Is it legal with Indy? |
|
|
"Salvatore Besso" <s.besso (AT) mclink (DOT) it> wrote
| Quote: | I was wondering if it is legal, while a POP3 session is in progress,
to open, work with and close SMTP sessions.
|
Of course. The two have nothing to do with each other.
| Quote: | Basically what I'm doing is more or less:
|
Although what you are doing is technically legal (though it needs error
handling added), I would suggest instead caching the POP3 messages, then
disconnect and loop through the cache afterwards.
Gambit
|
|
| Back to top |
|
 |
Salvatore Besso Guest
|
Posted: Thu Dec 16, 2004 12:08 pm Post subject: Re: Is it legal with Indy? |
|
|
hello Remy,
| Quote: | Of course. The two have nothing to do with each other.
|
even if the POP3 server and the SMTP server addresses are the same?
| Quote: | I would suggest instead caching the POP3 messages, then
disconnect and loop through the cache afterwards.
|
What do you suggest in this case? A dynamic array of TIdMessage's? A last
question: If I cache as you suggest and disconnect, when I reconnect to the POP3
server do the message numbers retrieved stay consistent? Suppose I have
retrieved and cached message number 22 and then disconnected. When I reconnect
is the message 22 still the same as before and can I safely delete it? I don't
want to accidentally delete the wrong message :-)
Thank you and best Season's Greetings
Salvatore
|
|
| Back to top |
|
 |
Thomas Wegner Guest
|
Posted: Thu Dec 16, 2004 4:20 pm Post subject: Re: Is it legal with Indy? |
|
|
| Quote: |
even if the POP3 server and the SMTP server addresses are the same?
|
You can build a Server that contains SMTP, POP3, HTTP and FTP.
This make not SMTP equal to FTP or HTTP , there are always
different things also when you have a HTTP driven POP3 Client !
---------------------------------------------
Thomas Wegner
Cabrio Meter - The Weather Plugin for Trillian
http://www.wegner24.de
"Salvatore Besso" <s.besso (AT) mclink (DOT) it> schrieb im Newsbeitrag
news:41c17aad (AT) newsgroups (DOT) borland.com...
| Quote: | hello Remy,
Of course. The two have nothing to do with each other.
even if the POP3 server and the SMTP server addresses are the same?
I would suggest instead caching the POP3 messages, then
disconnect and loop through the cache afterwards.
What do you suggest in this case? A dynamic array of TIdMessage's? A last
question: If I cache as you suggest and disconnect, when I reconnect to
the POP3 server do the message numbers retrieved stay consistent? Suppose
I have retrieved and cached message number 22 and then disconnected. When
I reconnect is the message 22 still the same as before and can I safely
delete it? I don't want to accidentally delete the wrong message :-)
Thank you and best Season's Greetings
Salvatore
|
|
|
| Back to top |
|
 |
Lee_Nover Guest
|
Posted: Fri Dec 17, 2004 7:44 am Post subject: Re: Is it legal with Indy? |
|
|
| Quote: | Of course. The two have nothing to do with each other.
even if the POP3 server and the SMTP server addresses are the same?
yes |
| Quote: | I would suggest instead caching the POP3 messages, then
disconnect and loop through the cache afterwards.
What do you suggest in this case? A dynamic array of TIdMessage's? A
... or an objectlist of some sort |
loop thru messages, put them in the list, call delete per message
then disconnect from pop3 and loop thru the list to process the messages
| Quote: | last question: If I cache as you suggest and disconnect, when I
reconnect to the POP3 server do the message numbers retrieved stay
consistent? Suppose I have retrieved and cached message number 22 and
then disconnected. When I reconnect is the message 22 still the same as
before and can I safely delete it? I don't want to accidentally delete
the wrong message
the id's are stored per session |
if you get the list at one place (1-5)
and at another place(different session) you delete msg (3),
the msg 3 will still be valid for the first session but not for the second
the actual deletion is done when all sessions are closed (to the same
account ofcourse)
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Dec 17, 2004 10:43 am Post subject: Re: Is it legal with Indy? |
|
|
"Salvatore Besso" <s.besso (AT) mclink (DOT) it> wrote
| Quote: | even if the POP3 server and the SMTP server addresses are the same?
|
Yes. There are completely different protocols running on their own
independant sockets.
| Quote: | What do you suggest in this case? A dynamic array of TIdMessage's?
|
Yes.
| Quote: | If I cache as you suggest and disconnect, when I reconnect to the
POP3 server do the message numbers retrieved stay consistent?
|
No, because you are deleting the messages before disconnecting. They won't
be available anymore when you reconnect.
If, on the other hand, you do not delete the messages, then the numbers are
not guaranteed to be the same when you reconnect. That is dependant on the
server's implementation. From your perspective, you can only rely on the
numbers remaining the same while you are still connected. You need to treat
them on a per-session basis. If you want to locate the message after
re-connecting, then you need to look at the MsgID values rather than the
index numbers.
| Quote: | Suppose I have retrieved and cached message number 22 and then
disconnected. When I reconnect is the message 22 still the same as
before
|
No, because you deleted it from the server before disconnecting.
Gambit
|
|
| Back to top |
|
 |
Salvatore Besso Guest
|
Posted: Fri Dec 17, 2004 3:23 pm Post subject: Re: Is it legal with Indy? |
|
|
hello all,
thanks for your exahustive replies.
For Gambit:
| Quote: | Suppose I have retrieved and cached message number 22 and then
disconnected. When I reconnect is the message 22 still the same as
before
No, because you deleted it from the server before disconnecting.
|
I was meaning retrieved, cached and *not* deleted in the first session. The
deletion should happen in the second session when I reconnect to the POP3 and
only if message processing *succeeded*. So I asked if *only* in this case the
message number stays consistent.
I know that it would be more effcient and easy to retrieve, process, send
auto-respnse messages and delete if successful in the same POP3 session, but as
already mentioned I'm fighting against a subtle error 10053 when I'm trying to
delete the message and I'm still not able to find the reason why it happens.
Regards
Salvatore
|
|
| Back to top |
|
 |
Salvatore Besso Guest
|
Posted: Fri Dec 17, 2004 5:02 pm Post subject: Re: Is it legal with Indy? |
|
|
hello all,
ok, don't mind anymore. I have finally resolved the error 10053 problem and I
can perform all operations in the same session now.
Thanks to all for the support.
Season's Greetings
Salvatore
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Dec 17, 2004 6:52 pm Post subject: Re: Is it legal with Indy? |
|
|
"Salvatore Besso" <s.besso (AT) mclink (DOT) it> wrote
| Quote: | ok, don't mind anymore. I have finally resolved the error 10053
problem and I can perform all operations in the same session now.
|
What was the actual problem that was causing it?
Gambit
|
|
| Back to top |
|
 |
Salvatore Besso Guest
|
Posted: Sat Dec 18, 2004 1:27 am Post subject: Re: Is it legal with Indy? |
|
|
hello Gambit,
| Quote: | ok, don't mind anymore. I have finally resolved the error 10053
problem and I can perform all operations in the same session now.
What was the actual problem that was causing it?
|
I have still to evaluate but it is very strange. The error disappeared when I
have moved a whole try..except block to the outermost procedure. The scenario
when the error was present was more or less as follows:
.....
private
procedure MyDataModule.RetrieveHeaders....
(might raise exceptions)
procedure MyDataModule.RetrieveMessages....
(might raise exceptions)
procedure MyDataModule.DoInternetImport....
begin
try
try
....
Elaborate; (might raise exceptions)
if Ok then
SendAutoReplyWithSMTP;
except
Series of "on E: ExceptionType do..." with SendAutoReplyWithSMTP if
necessary
end
finally
....
end
end;
public
procedure MyDataModule.ImportFromInternet....
begin
try
ConnectToInternet;
Pop3Connect;
DoSomeInit;
RetrieveHeaders;
RetrieveMessages;
DoInternetImport
finally
Pop3Disconnect;
DisconnectFromInternet
end
end;
As you can see, I have moved the whole "try..except" block from DoInternetImport
(private) to ImportFromInternet (public) that is the only method visible from
the form that uses this data-module. Tomorrow I will investigate for the
possible reasons that lead to the error 10053 and why it has been eliminated by
simply moving the try..except block. Actually it is still a mystery. Anyway it
seems more logic to me to have the exception control block in the outermost
method and I don't know why I have put it there initially, maybe I was sleeping
and programming at the same time...:-)
Regards
Salvatore
|
|
| 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
|
|