Nomsa Guide
  • 👋About Nomsa
  • Campaign Guide - General
    • 🚀How to send a campaign?
  • Campaign Guide - Email
    • 📧Email Campaigns - Basics
      • 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
  • Campaign Guide - SMS
    • 📲SMS Campaigns - Basics
    • SMS Onboarding Overview
      • How do I send SMS
  • Campaign Guide - Telegram
    • 🤖Telegram Campaigns - Basics
      • Add Telegram Bot Token in Nomsa
      • Instructions for Recipient Onboarding
      • Use the Bot in the Campaign
      • Telegram Formatting
      • Telegram Bot Statistics
  • Api Guide
    • 📖Overview
      • API Response Formats
      • Bearer Authentication
      • Generate your API Key
      • Rotate your API Key
    • 📨Programmatic Email API
      • 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 SMS API
Powered by GitBook
On this page
  • Overview
  • Supported attachment file types
  • Sample API calls
  • API call with one attachment
  • API call with two attachments
  • Sample code
  • JavaScript
  1. Api Guide
  2. Programmatic Email API
  3. Send Email API

Attachments

PreviousContent-ID ImagesNextRate Limit

Last updated 1 year ago

Our programmatic email API supports attachments via .

Overview

  • The attachment feature is only available to users who have . If your agency would like to set this up, .

  • Each email can have up to 10 attachments.

  • Each attachment should not exceed 2MB in size.

  • The cumulative size of all attachments should not exceed 10MB.

  • You can find the list of supported attachment file types below.

You will receive a 413 error if the requirements above are not met.

Supported attachment file types

List of supported attachment file types
  • asc

  • avi

  • bmp

  • csv

  • dgn

  • docx

  • dwf

  • dwg

  • dxf

  • ent

  • gif

  • jpeg

  • jpg

  • mpeg

  • mpg

  • mpp

  • odb

  • odf

  • odg

  • ods

  • pdf

  • png

  • pptx

  • rtf

  • sxc

  • sxd

  • sxi

  • sxw

  • tif

  • tiff

  • txt

  • wmv

  • xlsx

Sample API calls

API call with one attachment

curl --location 'https://api.nomsa.gov.kh/v1/transactional/email/send' \
--header 'Authorization: Bearer {{apikey}}' \
--form 'body="<p>Hello <b>there</b></p>"' \
--form 'recipient="recipient@gmail.com"' \
--form 'attachments=@"/your/local/path-to-file"' \
--form 'subject="Test Attachments email"' \
--form 'from="NomsaSupportTeam <nomsa@dgc.gov.kh>"'

API call with two attachments

curl --location 'https://api.nomsa.gov.kh/v1/transactional/email/send' \
--header 'Authorization: Bearer your_api_key' \
--form 'body="<p>Hello <b>there</b></p>"' \
--form 'recipient="recipient@gmail.com"' \
--form 'attachments=@"/your/local/path-to-file-1"' \
--form 'attachments=@"/your/local/path-to-file-2"' \
--form 'subject="Test two attachments"' \
--form 'from="NomsaSupportTeam <nomsa@dgc.gov.kh>"'

Sample code

JavaScript

const data = new FormData();
data.append("recipient", "recipient@agency.gov.kh");
data.append("subject", "Test email");
data.append("body", "<p>Hello <b>there</b></p>");
data.append("from", "NomsaSupportTeam <nomsa@dgc.gov.kh>");
data.append("attachments", "/your/local/path-to-file-1");
data.append("attachments", "/your/local/path-to-file-2");

const xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.nomsa.gov.kh/v1/transactional/email/send");
xhr.setRequestHeader("Authorization", "Bearer your_api_key");

xhr.send(data);
📨
multipart/form-data requests
set up sending emails from their own domains
contact us