fix(core): update

This commit is contained in:
Philipp Kunz 2019-10-27 22:53:21 +01:00
parent b97740094b
commit 0a758cdb60

View File

@ -40,14 +40,39 @@ export class MailgunAccount {
/**
* sends a SmartMail
*/
public sendSmartMail(smartmailArg: plugins.smartmail.Smartmail) {
public sendSmartMail(smartmailArg: plugins.smartmail.Smartmail, toArg: string, dataArg = {}) {
const domain = smartmailArg.options.from.split('@')[1];
this.postFormData(`/${domain}/messages`, [
const formFields: plugins.smartrequest.IFormField[] = [
{
name: 'from',
type: 'string',
payload: smartmailArg.options.from
},
{
name: 'to',
type: 'string',
payload: toArg
},
{
name: 'subject',
type: 'string',
payload: smartmailArg.getSubject(dataArg)
},
{
name: 'html',
type: 'string',
payload: smartmailArg.getBody(dataArg)
}
]);
];
for (const attachment of smartmailArg.attachments) {
formFields.push({
name: 'attachment',
type: 'Buffer',
payload: attachment.contentBuffer
})
}
this.postFormData(`/${domain}/messages`, formFields);
}
}