login about faq

I'm trying to send emails with a signature, it's a JPG file, and I want to embed in email foot.

I'm writing one cid in Html code img src='cid:Signature'

And after I make ::oMail:AddRelatedFile2( cSignatureFile, "Signature" )

However the email is received, the file is attached, but there is a "missing image" block in the body where the image is supposed to be in the body of the mail?

Wath's the problem.

Thanks.

How can the relative addressing work? Assuming the example is correct... or what else could be wrong?

Thanks!

asked Jun 09 '16 at 02:12

Bingen's gravatar image

Bingen
1


There are two ways for HTML to reference an image (or perhaps a CSS file) that is located elsewhere within the MIME of the email (under the multipart/related enclosure -- thus they are called "related items" rather than attachments. Attachments are located in the MIME under the multipart/mixed enclosure).

  1. The URI in the HTML can be a "cid:{content-id}" URI. In this case, the {content-id} must match the value of the Content-ID header field in the MIME sub-part containing the image. The addRelatedFile method is for adding a related file using a Content-ID (because it returns the Content-ID string that should be placed in the HTML.
  2. Alternatively, the URI in the HTML can be a URL, path, etc, and it must match the value of the Content-Location header field for the MIME sub-part that contains the image data. The addRelatedFile2 method is or adding a related item using Content-Location. It allows for you to specify the Content-Location in the 2nd argument, which is appropriately named "filenameInHtml". See the online reference documentation.
link

answered Jul 25 at 15:57

chilkat's gravatar image

chilkat ♦♦
12.8k317363471

According to this example it shows this:

//  For whatever reason, the iPhone's email program requires
//  images in HTML to be referenced by Content-ID.  Therefore,
//  we must add the image like this:
const wchar_t *contentIdStarfish = email.addRelatedFile(L"qa_data/jpg/starfish.jpg");
if (email.get_LastMethodSuccess() != true) {
    wprintf(L"%s\n",email.lastErrorText());
    return;
}

//  The src attribute for the image tag is set to the contentIdStarfish:
CkStringBuilderW sbHtml;
sbHtml.Append(L"<html><body><p>This is an HTML email with an embedded image.</p>");
sbHtml.Append(L"<p><img src=\"cid:CONTENT_ID_STARFISH\" /></p></body></html>");
int numReplacements = sbHtml.Replace(L"CONTENT_ID_STARFISH",contentIdStarfish);

email.SetHtmlBody(sbHtml.getAsString());
link

answered Jul 25 at 10:17

ajtruckle2017's gravatar image

ajtruckle2017
1

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×89

Asked: Jun 09 '16 at 02:12

Seen: 517 times

Last updated: Jul 25 at 15:57

powered by OSQA