|Subject:||Re: POP3.Retrieve method - Error deleting Attachments|
|Posted by:||Remy Lebeau \(Indy Team\) (firstname.lastname@example.org)|
|Date:||Mon, 23 Oct 2006|
"Keith" <kroge…@sark.com> wrote in message
> I'm developing a project using Indy Sockets 10.1.5.23738, and when I
> deploy the project to the dev server, I get the following exception
> This only occurs when I am retrieving emails with attachments.
Matching that stack trace to Indy's source code, it would appear that
ProcessMessage() is throwing an exception (which is not shown in the stack
trace) while processing the attachment data. That exception causes the
AttachmentFile object to be destroyed and removed from the Message. When
the AttachmentFile's destructor is called, it tries to delete the temp file
that was created to hold the data. The exception you are seeing is occuring
at that point. Which makes no sense, because the AttachmentFile has already
released its hold on the file by that time. So maybe .NET itself is still
holding on to the file internally for some reason?
The other piece of the puzzle that needs to be identified is why
ProcessMessage() threw an exception during parsing to begin with. One way
to attempt to diagnose that is to use the Message object's
OnCreateAttachment event to manually create an AttachmentMemory object for
the attachments. That will take the temp files out of the equation.
Hopefully you will then be able to see the original exception.
> Is there a way that I can specify this temp folder?
The Message object has an AttachmentTempDirectory property. It is empty by
default, which causes attachments to be stored in the OS temp folder.
> Or perhaps check to see if a message has an attachment before retrieving
There is no way to do that with the POP3 protocol.
POP3.Retrieve method - Error deleting Attachments posted by Keith on Mon, 23 Oct 2006