…thoughts on ServiceNow and digital transformation

Post

Inline images in outbound html emails


If you paste images into the body of an html email notification, the source of the image is the record in sys_attachment. If the user doesn’t have access to the attachment (i.e. to the underlying record), they won’t see the image in their email. One option is to put the image in the db_image table, however this makes the image public and sometimes this is a no-go. Another option is to attach the image to the outbound email and embed it in the html. Here are the steps for this second option:

1. Follow the instructions for “generic” attachments: https://incident.do/2024/02/15/adding-the-same-attachment-to-a-notification-every-time-it-sends/

2. Check the Include attachments from this notification box

3. Paste your image inline in the Message HTML field of the notification.

4. The pasted image will have a name like Pasted image.png. Rename it to something more meaningful. Note that the filename should NOT contain spaces.

5. Go to the html of the Message HTML field and find the img tag for the image. It will look something like the below

<img src="/sys_attachment.do?sys_id=3e1333fc87901a1077df42e50cee3585" width="195" height="39" border="0"/>

Change it to

<img src="cid:your_file_name.png" width="195" height="39" border="0" />

6. Test the notification on a server with email turned on. Note that in the preview and in the activity stream, the image will not be visible.