delphi - Embed Image to Outlook using extended mapi functions -
I have to preview the email before embedding images in the email and sending it to Outlook. CDO and redemption is not an option.
I have tried the following code, but the images only appear in the form of a small block
Add processTouch (full filename: string; Attachment: Outlook 2000 Attachment; cid: string); Const PR_ATTACH_CONTENT_ID = $ 3712001 E; PR_ATTACH_CONTENT_ID_W = $ 3712001F; // Unicode PR_ATTACH_MIME_TAG = $ 370E001E; PR_ATTACH_ENCODING = $ 37020102; Var IAttach: IMAPIProp; Prop: PSPropValue; Attachment: Outlook 2000. Attachment; Filename: string; Suppose: TSPProl value; Prop. 1: Tasptopagare; Start filename: = ExtractFileName (FullFileName); Prop: = zero; Attempt: Try Attachments. Add (FullFileName, olByValue, 1, FileName); IAttach: = AAttachment.MAPIOBJECT as IMAPIProp; If assigned (IAttach) try PropValue.ulPropTag: = PR_ATTACH_MIME_TAG; PropValue.Value.lpszA: = 'Image / JPEG'; HRSetAnPap (IAttach, @PropValue); PropValue.ulPropTag: = PR_ATTACH_CONTENT_ID; PropValue.Value.lpszA: = Panscher (ANIstring (CID)); HRSetAnPap (IAttach, @PropValue); Eventually, if assigned (prop) then mapfreefuffer (prop); IAttach: = Nil; End; Excluding the End; End;
The questioner has not posted his HTML text, I suspect that his CID The URLs were flawed - although I have not tested this.
If the Content-ID header is set to:
Content-Type: Image / JPEG Content-Displacement: Inline Content-ID: FD 383888 E 86 AD 97070 @U
Then the HTML should reference such as:
Specifically, the CID URL should have the prefix "cid:", but the content-ad head should not be. (A grid is a good option for a content-id, except that it should contain a @
symbol. You can add '@u' to the GUID.) < / P>
At the receiving end of this email message is enough to display correctly
You can also see this question:
Comments
Post a Comment