Synced messages do not display inline images

As the developer how do you render the the inline CID images returned via the API.

Synced / received messages images are present but not displayed, this is typically due to content_type not being defined. 

 

To display inline images, you will need to replace the <img> tag's src attribute from cid: to data: like this:
 

<img border="0" width="378" height="173" style="width:3.9416in;height:1.8in" id="m_2324283022094017882Picture_x0020_1" src="cid:17eaf43558ca175ef7">

 
to:
 

<img border="0" width="378" height="173" style="width:3.9416in;height:1.8in" id="m_2324283022094017882Picture_x0020_1" src="data:image/jpeg;base64;<file_id>">

 
where <file_id> is the file's content that you can get via the `/files` endpoint.

 

Our email component performs the same action via Javascript see our Email Component's repository: https://github.com/nylas/components/blob/15e3b0f4b80f828c671f772598bc988b379159ec/components/email/src/Email.svelte#L815-L829

 

 

Resources:

https://developer.nylas.com/docs/intelligence/clean-conversations/#images 

Sent emails do not display inline images

 

 

Updated

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.