Postman Guide
Go to Postman v1
  • 🥳About Postman v1 (Postman Legacy)
  • Campaign Guide - General
    • 🚀How to send a campaign?
      • ☝️Before You Start
        • Demo Mode
  • Campaign Guide - Email
    • 📧Email Campaigns - Basics
      • How do I send an email campaign?
      • Scheduled Sending
      • Bounced Emails and Halted Campaigns
      • Email Statistics
      • Formatting your Message Template
      • Variable Fields
      • Unique URL Link per Recipient
      • Pasting Content from Microsoft Word
      • Manage your Unsubscriptions
      • Understanding Unsubscriptions
    • 🔐Sending Password-Protected Emails
      • Tutorial
      • Template Editor
  • Campaign Guide - SMS
    • 📲SMS Campaigns - Basics
      • Before Starting Out
      • Summary of Costs
    • 🪜SMS Onboarding Overview
      • Step 1: Sender ID Registration
      • Step 2: Sign up for a Twilio account
      • Step 3: Set up your Twilio account
      • Step 4: Configure Your Twilio Account
        • What if I need to buy a phone number?
      • Step 5: Send a Test Message on Twilio
      • Step 6: Fill in your Twilio credentials in Postman!
        • How do I send a campaign with my saved SMS credentials?
    • 🤔What else do I need to know about sending SMSes?
      • More about Sender ID registration
      • Can I see the send status of my campaign?
      • How can I configure my SMS send rate?
      • Sending an SMS to a Foreign Number
      • SMS Best Practices
      • Useful Twilio Links
  • Campaign Guide - Telegram
    • 🤖Telegram Campaigns - Basics
      • How do I set up Telegram to send my campaigns?
      • Add Telegram Bot Token in Postman
      • Instructions for Recipient Onboarding
      • Use the Bot in the Campaign
      • Telegram Formatting
      • Telegram Bot Statistics
  • Email API Guide
    • 📖Overview
      • IM8 Policies
      • Connecting your Intranet Application
      • API Response Formats
    • 🗝️Email API Key Management
      • Bearer Authentication
      • Generate your email API Key
      • Rotate your email API Key
    • 📨Programmatic Email API
      • Getting Started
      • Comparison with AMR
      • SG-Mail Whitelisting
      • Custom From Address
      • Tracking Email Status
      • Send Email API
        • From Name and From Address
        • CC and BCC
        • Recipient Blacklist
        • Email Tagging and Classification
        • Email Body
          • Embedding Images
            • Linked Images
            • Content-ID Images
        • Attachments
        • Rate Limit
      • Get Email by ID API
      • List Emails API
    • 📨Programmatic GovSG WhatsApp API
      • Getting Started
      • Tracking Message Status
      • Get Available Templates API
      • Send Message API
      • Get Message by ID API
      • List Messages API
    • 🎓Frequently Asked Questions
  • FAQ
    • 📶Service Status
    • For Recipients
      • Check Email Authenticity
    • For Senders
      • Messaging Channel Comparison
      • Cost Breakdown
  • Legal
    • Terms & Conditions
    • Privacy Policy
  • Contact Us
  • GitHub
Powered by GitBook
On this page
  • How It Works
  • Not Recommended for Same Images Across Multiple Emails
  • Unique Image for Each Email
  • Using our API
  • Example API Request

Was this helpful?

  1. Email API Guide
  2. Programmatic Email API
  3. Send Email API
  4. Email Body
  5. Embedding Images

Content-ID Images

PreviousLinked ImagesNextAttachments

Last updated 9 months ago

Was this helpful?

How It Works

Content-ID images work by attaching the image to the email you send and then using standard HTML image tags that reference that image to eventually embed it in the email when the user opens it.

Not Recommended for Same Images Across Multiple Emails

If you are using the same set of images across multiple emails, we advise you to look into using linked images for the following reasons:

  • As the same images are being used, attaching the same image to each email is inefficient and bad for the environment

  • Content-ID images are larger in size as the image is attached to the email. This slows down your API calls and increases costs.

For more information, .

Unique Image for Each Email

Content-ID images can be used for embedding dynamically generated images in your emails. This is a reasonable alternative for agencies that are unable to host images on the Internet.

Using our API

To support content-ID images, we have parsed each attachment to add a cid field based on the order in which they are attached. This allows the first attachment to be referenced by cid:0, the second by cid:1, and so on. You can then use these cid values in your HTML image tags.

Note that the cid values are zero-indexed, i.e. the first attachment is cid:0, the second is cid:1, and so on. This cid field is added for all files, including non-image files.

As content-ID images work by attaching emails, you will need to fulfill the requirements

Example API Request

The following example shows how you can use the cid field to embed images in your email.

curl --request POST \
  --url https://api.postman.gov.sg/v1/transactional/email/send \
  --header 'Authorization: Bearer <API-KEY>' \
  --header 'Content-Type: multipart/form-data' \
  --form recipient=recipient@agency.gov.sg \
  --form from=sender@agency.gov.sg \
  --form 'subject=test cid' \
  --form 'body=Hello there.
<br>
<img src="cid:0">
<br>
<img src="cid:1">
<br>
<img src="cid:2">
<br>
<img src="cid:3">
<br>
<img src="cid:4">
' \
  --form 'attachments=@/path/to/attachment/1 one.png' \
  --form 'attachments=@/path/to/attachment/2 two.png' \
  --form 'attachments=@/path/to/attachment/3 three.png' \
  --form 'attachments=@/path/to/attachment/4 four.png' \
  --form 'attachments=@/path/to/attachment/5 five.png'

The resulting email:

📨
see here