Skip to content

Commit

Permalink
feat(message): allow sending driver extras
Browse files Browse the repository at this point in the history
`driverExtras` method can be used to send extras to the current driver in use
  • Loading branch information
thetutlage committed Aug 24, 2017
1 parent 604650a commit 91430c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Mail/Message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,22 @@ class Message {
return this.attach(filePath, Object.assign({ cid }, options))
}

/**
* Set extras to be sent to the current driver in
* use. It is the responsibility of the driver
* to parse and use the extras
*
* @method driverExtras
*
* @param {Object} extras
*
* @chainable
*/
driverExtras (extras) {
this.mailerMessage.extras = extras
return this
}

/**
* Returns nodemailer compatable message
* object
Expand Down
9 changes: 9 additions & 0 deletions test/message.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,13 @@ test.group('Message', () => {
inReplyTo: '11010'
})
})

test('define driver extras', (assert) => {
const message = new Message()
message.driverExtras({ campaign_id: 20 })

assert.deepEqual(message.toJSON(), {
extras: { campaign_id: 20 }
})
})
})

0 comments on commit 91430c9

Please sign in to comment.