Discuss this help topic in SecureBlackbox Forum

Add attachments

To add attachments to the simple MIME message use AddAttachment() method of TElSimpleMIMEMessage class. The method returns the index of the newly added attachment in the list of attachments.

The list of attachments is accessible via Attachments[] property of TElSimpleMIMEMessage class. Each element of the list is an instance of TElSimpleMIMEAttachment class. This instance contains information about one attachment.

To find out the number of attachments in the list use AttachmentCount property of TElSimpleMIMEMessage class.

To remove the attachment from the list use RemoveAttachment method of TElSimpleMIMEMessage class.

You need to set the following information about the attachment using TElSimpleMIMEAttachment class:

  • ContentId. This must be a globally-unique string that identifies the message part.
  • ContentType. By default, it's 'application/octet-stream', but you can set other value if needed.
  • Name. This is the name of the file being attached.
  • ContentStream. This is the body of the attachment. When TElSimpleMIMEAttachment is disposed, the stream is closed and disposed of too.

How To articles about simple MIME message creator

Discuss this help topic in SecureBlackbox Forum