From c60702fb49c7c6b89d275bc48bb10ecbff9efb51 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Mon, 28 Oct 2019 16:15:16 +0100 Subject: [PATCH] fix(core): update --- ts/mailgun.classes.account.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ts/mailgun.classes.account.ts b/ts/mailgun.classes.account.ts index 4f8b5f4..8672aeb 100644 --- a/ts/mailgun.classes.account.ts +++ b/ts/mailgun.classes.account.ts @@ -14,7 +14,7 @@ export class MailgunAccount { method: 'GET', headers: { Authorization: `Basic ${plugins.smartstring.base64.encode( - this.apiToken + `api:${this.apiToken}` )}`, 'Content-Type': 'application/json' } @@ -28,7 +28,7 @@ export class MailgunAccount { { headers: { Authorization: `Basic ${plugins.smartstring.base64.encode( - this.apiToken + `api:${this.apiToken}` )}` } }, @@ -75,6 +75,10 @@ export class MailgunAccount { } const response = await this.postFormData(`/${domain}/messages`, formFields); - console.log(response); + if (response.statusCode === 200) { + return response.body; + } else { + throw new Error('could not send email'); + } } }