dbarjs
8/3/2016 - 3:19 PM

gistfile1.txt

var data = JSON.stringify({
  "From": "mailman@elbit.com.br",
  "To": "eduardo@elbit.com.br, rafael@elbit.com.br, cristiano@elbit.com.br",
  "Subject": "Test",
  "Tag": "Invitation",
  "HtmlBody": "<b>Olá</b>, tudo bem? haha",
  "TextBody": "Olá, tudo bem?",
  "ReplyTo": "mailman@elbit.com.br"
});

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

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

xhr.open("POST", "https://api.postmarkapp.com/email");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("x-postmark-server-token", "93310232-b87b-4cf0-be46-58e5ac3f77b8");
xhr.setRequestHeader("cache-control", "no-cache");
xhr.setRequestHeader("postman-token", "574a31e8-5bbd-90a4-7958-b93381a74b64");

xhr.send(data);