From d5575ab5b578ee5492d7a9716ccdf0bbbbb17014 Mon Sep 17 00:00:00 2001 From: David Kebler Date: Tue, 13 Oct 2020 08:36:56 -0700 Subject: [PATCH] fixed bug where preset subject option was not being used --- email.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/email.js b/email.js index c515eb5..aa1d472 100644 --- a/email.js +++ b/email.js @@ -14,14 +14,13 @@ class Email { } Object.assign(this._pkg,opts.credentials) this.smtp = opts.smtp || 'gmail' - this._send = create[this.smtp](this.pkg) + this._send = create[this.smtp](this._pkg) } - async send (msg='', opts={}) { const pkg = Object.assign({},this._pkg,opts) - if (typeof msg === 'string') { pkg.subject = msg; pkg.text = msg } + if (typeof msg === 'string') { pkg.subject = this._pkg.subject || msg; pkg.text = msg } else { - pkg.subject = msg.msg || msg.message || msg.subject + pkg.subject = msg.subject || this._pkg.subject || msg.msg || msg.message pkg.text = msg.text || nice(msg) pkg.html = msg.html pkg.files = msg.files