Thread View: borland.public.cppbuilder.internet.socket
6 messages
6 total messages
Started by LarryJ
Sat, 16 Dec 2006 14:20
Net Master POP3 Question
Author: LarryJ
Date: Sat, 16 Dec 2006 14:20
Date: Sat, 16 Dec 2006 14:20
9 lines
1275 bytes
1275 bytes
I am working with the sample email program that comes with BCB6. This uses the component Net Masters POP3 version 5.3.0.1055. How to I set the function NMPOP31->GetMailMessage( MsgNum ); so it will ignore attachments? Right now the email attachments are automatically saved to the hard drive which I do not want. Thanks Larry Johnson
Re: Net Master POP3 Question
Author: Hans Galema
Date: Sat, 16 Dec 2006 14:36
Date: Sat, 16 Dec 2006 14:36
38 lines
2222 bytes
2222 bytes
LarryJ wrote:
> How to I set the function NMPOP31->GetMailMessage( MsgNum ); so it will
> ignore attachments? Right now the email attachments are automatically saved
> to the hard drive which I do not want.
It is not clear to me what you exactly mean with ignoring them. The message
contains the attachments so they are there.
Could you tell if they are contained in NMPOP31->MailMessage->Body->Text;?
And where are they saved now ? There is a property NMPOP31->AttachFilePath;
What are you doing with it?
And then there is (from the help):
<quote>
Insert the following code into NMPOP31's OnDecodeStart event:
void __fastcall TForm1::NMPOP31DecodeStart(AnsiString &FileName);
{
AnsiString S;
S = FileName;
if (InputQuery("Save File Attachment", "Filename?", S))
FileName = S;
}
When a file attachment begins decoding, the OnDecodeStart
event is called. In this example, the InputQuery function
is used to retrieve a file name. If the Ok button is clicked,
the FileName parameter is changed to the new value entered
in the input box.
</quote>
Do you use this event? And did you try to specify an empty filename?
And about your former post: could you use the hint?
Hans.
Re: Net Master POP3 Question
Author: LarryJ
Date: Sun, 17 Dec 2006 15:30
Date: Sun, 17 Dec 2006 15:30
28 lines
1895 bytes
1895 bytes
1) What I meant by "ignore the attachments" is that I do not want to automatically save the attachments. The sample POP3 program automatically saves the attachments and I don't see how to turn that off. 2.) Yes, I can see the attachment names in MailMessage->Body->Text; 3.) The property "AttachFilePath" is set as the default, NMPOP31->AttachFilePath = "."; 4.) The attachments are saved to the same location as the .EXE. 5.) I have seen the "DecodeStart" code but that code only asks to changes the attachments file name it has no affect on saving or not saving the file. If the name input is left blank the program will throw an error. 6.) Maybe there is no way to turn off the NMPOP31 attachment saving? Thanks Larry Johnson "Hans Galema" <notused@notused.nl> wrote in message news:4584049e$1@newsgroups.borland.com... > LarryJ wrote: >
Re: Net Master POP3 Question
Author: Hans Galema
Date: Sun, 17 Dec 2006 16:00
Date: Sun, 17 Dec 2006 16:00
38 lines
2364 bytes
2364 bytes
LarryJ wrote: > 2.) Yes, I can see the attachment names in MailMessage->Body->Text; Only the names? Not the encoded data for the attachments? > 3.) The property "AttachFilePath" is set as the default, > NMPOP31->AttachFilePath = "."; > > 4.) The attachments are saved to the same location as the .EXE. I asked you if you experimented with that. For instance you could leave it blank or provide an invalid path. > 5.) I have seen the "DecodeStart" code but that code only asks to changes > the attachments file name it has no affect on saving or not saving the file. Well you can remove the question and provide an invalid filename. > If the name input is left blank the program will throw an error. Well that is nice isn't it!? You could handle that error in a try/catch block and neglect it. Didn't you try? What happens after the error? Is the message still there? > 6.) Maybe there is no way to turn off the NMPOP31 attachment saving? It seems to me that you are not really experimenting to see if you can force it to do what you want. > "Hans Galema" <notused@notused.nl> wrote in message > news:4584049e$1@newsgroups.borland.com... >>And about your former post: could you use the hint? And that question was not answered. I wonder why? Hans.
Re: Net Master POP3 Question
Author: LarryJ
Date: Sun, 17 Dec 2006 17:54
Date: Sun, 17 Dec 2006 17:54
32 lines
2164 bytes
2164 bytes
1) Here is the answer. The NMPOP31 has no built in way to turn off the
automatic attachment saving. I am going to have to look for a different
component that has a built in property for turning off the attachment
saving.
2) The only work around seems to be using the DecodeStart event as seen
below so all attachments over write each other with the same file name.
void __fastcall TFormMain::NMPOP31DecodeStart(AnsiString &FileName)
{
AnsiString S;
S = "DeleteMe.txt";
FileName = S;
}
3) I didn't understand your question "And about your former post: could you
use the hint?" because you added this in the response to my first post about
turning off the attachment saving, so I was not clear about which "former
post" you were referring too.
4) Possible solutions which force an exception which is then handled I wont
use. I have found this approach can cause unforeseen problems with third
party components.
Thanks
Larry Johnson
"Hans Galema" <notused@notused.nl> wrote in message
news:458569f2$1@newsgroups.borland.com...
>
Re: Net Master POP3 Question
Author: Remy Lebeau (TeamB)
Date: Mon, 18 Dec 2006 19:19
Date: Mon, 18 Dec 2006 19:19
26 lines
2429 bytes
2429 bytes
"LarryJ" <LarryJ33@austin.rr.com> wrote in message news:458583ea$1@newsgroups.borland.com... > The NMPOP31 has no built in way to turn off the automatic attachment > saving. I am going to have to look for a different component that has a > built in property for turning off the attachment saving. Indy 10 can handle that, with a little extra effort on your part. The simpliest way is to use the TIdMessage.OnCreateAttachment event to have TIdMessage use TIdAttachmentMemory objects for its attachments. The attachment data will be stored in memory instead of file. If you don't want the data to be stored at all, then you can derive new classes from TIdAttachment and TStream. Override the TStream.Write() method to simply discard any data that is written to it. Then override the TIdAttachment.PrepareTempStream() method to return an instance of your new TStream class, and override the FinishTempStream() method to free it. Then have the TIdMessage.OnCreateAttachment event handler return an instance of your new TIdAttachment class. This way, Indy can still parse all of the header information for the attachments, but not care what the actual attachment data is. Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads