Microsoft graph API, Inline image is not visible in Windows outlook app

Vikas Lokhande 0 Reputation points
2024-12-26T04:51:52.6866667+00:00

Hello, i am trying to send inline image which is about 1 mb or 1.5 max but its working in all platform like Mac outlook app and browser even its working in windows browser outlook app but not working windows outlook desktop app, can anyone please help me with it below is my mail body obejct const updatedBody = body.replace(/<img src="data:image/\w+;base64,([^"]+)"[^>]*>/g, (_, base64String, index) => {

const imageSize = Math.ceil((base64String.length * 3) / 4);

if (imageSize <= maxInlineImageSize) {

const contentId = image${index};

attachments.push({

"@odata.type": "#microsoft.graph.fileAttachment",

name: image${index}.jpg,

contentId: contentId,

contentBytes: base64String,

isInline: true,

});

return <img src="cid:${contentId}" />;

} else {

return <img src="http://example.com/placeholder.jpg" alt="Image size too large"/>;

}

});

return {

message: {

subject: subject,

body: {

contentType: 'HTML',

content: updatedBody

},

toRecipients: [

{

emailAddress: {

address: receipient

}

}

],

internetMessageHeaders: [

{

"name": InternetHeader.XSeismicOutlookPlugin,

"value": "true"

}

],

bccRecipients: (!!bcc && bcc.length > 0) ? bcc.map((bccEmail: string) => ({

emailAddress: {

address: bccEmail

}

})) : [],

attachments: attachments

},

saveToSentItems: 'false'

};

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,658 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.