fix(core): update
This commit is contained in:
parent
b97740094b
commit
0a758cdb60
@ -40,14 +40,39 @@ export class MailgunAccount {
|
|||||||
/**
|
/**
|
||||||
* sends a SmartMail
|
* 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];
|
const domain = smartmailArg.options.from.split('@')[1];
|
||||||
this.postFormData(`/${domain}/messages`, [
|
const formFields: plugins.smartrequest.IFormField[] = [
|
||||||
{
|
{
|
||||||
name: 'from',
|
name: 'from',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
payload: smartmailArg.options.from
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user