@dazejs/framework
Version:
Daze.js - A powerful web framework for Node.js
44 lines • 1.18 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailBuilder = void 0;
class MailBuilder {
constructor(manager) {
this.message = {};
this.manager = manager;
}
from(from) {
this.message.from = from;
return this;
}
to(to) {
this.message.to = to;
return this;
}
subject(subject) {
this.message.subject = subject;
return this;
}
html(html) {
this.message.html = html;
return this;
}
attachments(attachments) {
if (!(this.message.attachments && Array.isArray(this.message.attachments))) {
this.message.attachments = [];
}
this.message.attachments.push(...attachments);
return this;
}
attachment(attachment) {
if (!(this.message.attachments && Array.isArray(this.message.attachments))) {
this.message.attachments = [];
}
this.message.attachments.push(attachment);
return this;
}
async send() {
await this.manager.send(this.message);
}
}
exports.MailBuilder = MailBuilder;
//# sourceMappingURL=builder.js.map