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>"'
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>"'
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);