fix(core): update
This commit is contained in:
		| @@ -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); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user