6 Commits

Author SHA1 Message Date
ad6d18d306 1.0.11 2020-01-13 15:52:28 +00:00
7ddcd88862 fix(core): update 2020-01-13 15:52:27 +00:00
9d6b7f3b29 1.0.10 2020-01-13 15:52:03 +00:00
8be9fc38b6 fix(core): update 2020-01-13 15:52:02 +00:00
6bb3bb7d9a 1.0.9 2020-01-13 15:19:48 +00:00
7fcbd39166 fix(core): update 2020-01-13 15:19:47 +00:00
3 changed files with 11 additions and 6 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartmail",
"version": "1.0.8",
"version": "1.0.11",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartmail",
"version": "1.0.8",
"version": "1.0.11",
"private": false,
"description": "a unified format for representing and dealing with mails",
"main": "dist/index.js",

View File

@ -1,19 +1,20 @@
import * as plugins from './smartmail.plugins';
export interface ISmartmailOptions {
export interface ISmartmailOptions<T> {
from: string;
subject: string;
body: string;
creationObjectRef?: T;
}
/**
* a standard representation for mails
*/
export class Smartmail {
public options: ISmartmailOptions;
export class Smartmail<T> {
public options: ISmartmailOptions<T>;
public attachments: plugins.smartfile.Smartfile[] = [];
constructor(optionsArg: ISmartmailOptions) {
constructor(optionsArg: ISmartmailOptions<T>) {
this.options = optionsArg;
}
@ -21,6 +22,10 @@ export class Smartmail {
this.attachments.push(smartfileArg);
}
public getCreationObject(): T {
return this.options.creationObjectRef;
}
public getSubject(dataArg: any = {}) {
const smartmustache = new plugins.smartmustache.SmartMustache(this.options.subject);
return smartmustache.applyData(dataArg);