EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TelMessage How to remove attached file ?

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
Posted: 11/28/2014 10:28:15
by delagoutte jean (Standard support level)
Joined: 04/02/2009
Posts: 34

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

MsgToSend := TElMessage.create(false);
mmp := TElMultiPartList.Create(self, nil);
MsgToSend.SetMainPart(mmp, False);
  abody := TElPlainTextPart.Create;
// add attach file

I need to remove a file previously adding with "AttachFile" Method.
I 'll try

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 ?
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
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
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



Topic viewed 527 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!