fix(core): update
This commit is contained in:
@ -1,3 +1 @@
|
||||
import * as plugins from './mailgun.plugins';
|
||||
|
||||
export let standardExport = 'Hi there! :) This is an exported string';
|
||||
export * from './mailgun.classes.account';
|
||||
|
@ -14,7 +14,7 @@ export class MailgunAccount {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Basic ${plugins.smartstring.base64.encode(
|
||||
`api:key-a049e048b7029b9621c41b5682fadee9`
|
||||
this.apiToken
|
||||
)}`,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
@ -24,7 +24,7 @@ export class MailgunAccount {
|
||||
public async postFormData(routeArg: string, formFields: plugins.smartrequest.IFormField[]) {
|
||||
const requestUrl = `${this.baseUrl}${routeArg}`; // TODO;
|
||||
const response = await plugins.smartrequest.postFormData(
|
||||
routeArg,
|
||||
requestUrl,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Basic ${plugins.smartstring.base64.encode(
|
||||
@ -40,7 +40,7 @@ export class MailgunAccount {
|
||||
/**
|
||||
* sends a SmartMail
|
||||
*/
|
||||
public sendSmartMail(smartmailArg: plugins.smartmail.Smartmail, toArg: string, dataArg = {}) {
|
||||
public async sendSmartMail(smartmailArg: plugins.smartmail.Smartmail, toArg: string, dataArg = {}) {
|
||||
const domain = smartmailArg.options.from.split('@')[1];
|
||||
const formFields: plugins.smartrequest.IFormField[] = [
|
||||
{
|
||||
@ -69,10 +69,12 @@ export class MailgunAccount {
|
||||
formFields.push({
|
||||
name: 'attachment',
|
||||
type: 'Buffer',
|
||||
payload: attachment.contentBuffer
|
||||
})
|
||||
payload: attachment.contentBuffer,
|
||||
fileName: attachment.parsedPath.base
|
||||
});
|
||||
}
|
||||
|
||||
this.postFormData(`/${domain}/messages`, formFields);
|
||||
const response = await this.postFormData(`/${domain}/messages`, formFields);
|
||||
console.log(response);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user