This repository was archived by the owner on Oct 24, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,23 @@ function with addition of `packageSettings` key which will pass in package setti
106106set in your app settings (if any). It is up to you what you do in that function
107107as it will override the original sending function.
108108
109- Example :
109+ Here is a simple example with Mailgun :
110110``` javascript
111111import { Email } from ' meteor/email'
112+ import { Log } from ' meteor/logging'
113+ import Mailgun from ' mailgun-js'
112114
113- Email .customTransport = (options ) => {
115+ Email .customTransport = (data ) => {
114116 // `options.packageSettings` are settings from `Meteor.settings.packages.email`
115117 // The rest of the options are from Email.send options
116- customApi .send ({ from: options .packageSettings .fromOverride || options .from , to: options .to , message: options .html || options .text });
118+ const mailgun = Mailgun ({ apiKey: data .packageSettings .mailgun .privateKey , domain: ' mg.mygreatapp.com' })
119+
120+ // Since the data object that we recieve already includes the correct key names for sending
121+ // we can just pass it to the mailgun sending message.
122+ mailgun .messages ().send (data, (error , body ) => {
123+ if (error) Log .error (error)
124+ if (body) Log .info (body)
125+ })
117126}
118127```
119128
You can’t perform that action at this time.
0 commit comments