Question:
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!
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).
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());