Archived Forum Post

Index of archived forum posts


Renaming related items

Aug 30 '13 at 13:31

I'd like to be able to rename all of the related items in my email. I have 30 or so related items, all with a name around 240 characters in length. Due to certain limitations in a protocol of our product, the filename lengths can't be too long.

I know there is CkEmail::SetRelatedFilename(), but it is not clear whether or not this also renames the reference to the inline attachment from within the HTML DOM of the body. If not, how can I go about doing a proper and complete rename of the related attachments as well as references to it? Must this all be done by hand?

Accepted Answer

It should be the case that the SetRelatedFilename method does not affect the HTML.

Images and style sheets that are embedded within the multipart/related enclosure (in the MIME) and referenced from the HTML can be referenced in one of two ways:

1) Using a "CID" URL. For example: <img src="cid:CHILKAT-CID-325820ee-8eee-4140-838d-57a75b7788ca">
In this case, the image data is found by searching for the MIME part with the matching "Content-ID" header field.

2) Using a typical URL. In this case, the IMG tag looks just like a typical IMG tag in HTML found on a web server. For example:

<img src="someImage.jpg">


<img src="">

In this case, the image data is found by locating the MIME part where the Content-Location header matches the URL in the src attribute.

The SetRelatedFilename method sets the "filename" attribute of the Content-Type header field. This is entirely separate from both the Content-ID and Content-Location headers, and therefore the relationship between what is referenced in the HTML and the key fields in the MIME headers is not damaged.