EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TelMessage How to remove attached file ?

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#31534
Posted: 11/28/2014 10:28:15
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

Hello,
I'm using this code for prepare mail message and attach file to the mail message
Code

MsgToSend := TElMessage.create(false);
mmp := TElMultiPartList.Create(self, nil);
MsgToSend.SetMainPart(mmp, False);
  abody := TElPlainTextPart.Create;
   abody.SetText(aBodyText);
   mmp.AddPart(abody);
...
// add attach file
MsgToSend.AttachFile('application/octet-stream',aFilePath);


I need to remove a file previously adding with "AttachFile" Method.
I 'll try
Code
MsgToSend.Attachments[0].clear;

but with this code i receive an email with my body in txt join file and other txt empty file (one by file that i removed

What the good method for unattachfile ?
#31535
Posted: 11/28/2014 10:45:56
by Alexander Ionov (EldoS Corp.)

Thank you for contacting us.

Please try to use MsgToSend.MainPart.DeletePart(index).


--
Best regards,
Alexander Ionov
#31536
Posted: 11/28/2014 10:50:25
by Eugene Mayevski (EldoS Corp.)

Attachments[0] will return an object of TElMessagePart type. You should call "Attachments[0].Parent.DeletePart(Attachments[0], true)". This will remove a message part from the list and destroy it.


Sincerely yours
Eugene Mayevski
#31559
Posted: 12/02/2014 04:37:08
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

Good,it's working
Thank you

Reply

Statistics

Topic viewed 538 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!