Hello! I have never used mailgun before! I checked out this example and read the mailgun documentation.
I configurated everything how it should be, yet it gives me an error.
Did I forgot to add something ?
Do I have to configure something in the mailgun interface ?
send(recipient: string, subject: string, message: string) {
var requestHeaders = new Headers();
requestHeaders.append("Authorization", "Basic " + this.mailgunApiKey);
requestHeaders.append("Content-Type", "application/x-www-form-urlencoded");
this.http.request(new Request({
method: RequestMethod.Post,
url: "https://api.mailgun.net/v3/" + this.mailgunUrl + "/messages",
body: "from=" + this.senderMail + "&to" + recipient + "&subject=" + subject + "&text=" + message,
headers: requestHeaders
}))
.subscribe(success => {
console.log("SUCCESS -> " + JSON.stringify(success));
}, error => {
console.log("ERROR -> " + JSON.stringify(error));
});
}
My mailgunUrl looks like this:
sandboxNUMBERSandLetters.mailgun.org
This is my error:
Failed to load https://api.mailgun.net/v3/sandboxNUMBERSandLetters.mailgun.org/messages: Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.
feedback.ts:65 ERROR -> {"_body":{"isTrusted":true},"status":0,"ok":false,"statusText":"","headers":{},"type":3,"url":null}
Id be glad for any input!
Thanks for reading