Skip to content

Instantly share code, notes, and snippets.

@dbarjs
Created August 3, 2016 15:19
Show Gist options
  • Save dbarjs/5403d221f895cf74955a208138fa1c68 to your computer and use it in GitHub Desktop.
Save dbarjs/5403d221f895cf74955a208138fa1c68 to your computer and use it in GitHub Desktop.
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment