fixed bug where preset subject option was not being used

master
David Kebler 2020-10-13 08:36:56 -07:00
parent 5d69b39802
commit d5575ab5b5
1 changed files with 3 additions and 4 deletions

View File

@ -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