Skip to content
This repository was archived by the owner on Oct 24, 2021. It is now read-only.

Commit bd604da

Browse files
committed
Add example for Email.customTransport & document url parsing
1 parent a80dbca commit bd604da

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

source/api/email.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ you can setup the sending options in your app settings like this:
3939
```
4040
The package will take care of the rest.
4141

42+
> If you use a supported service the package will try to match to supported service and use the stored settings instead.
43+
> You can force this by switching protocol like `smtp` to the name of the service.
44+
> Though you should only use this as a stop-gap measure and instead set the settings properly.
45+
4246
If neither option is set, `Email.send` outputs the message to standard output
4347
instead.
4448

@@ -102,6 +106,17 @@ function with addition of `settings` key which will pass in package settings
102106
set in your app settings (if any). It is up to you what you do in that function
103107
as it will override the original sending function.
104108

109+
Example:
110+
```javascript
111+
import { Email } from 'meteor/email'
112+
113+
Email.customTransport = (options) => {
114+
// `options.settings` are settings from `Meteor.settings.packages.email`
115+
// The rest of the options are from Email.send options
116+
customApi.send({ from: options.settings.fromOverride || options.from, to: options.to, message: options.html || options.text });
117+
}
118+
```
119+
105120
> Note that this also overrides the development display of messages in console
106121
> so you might want to differentiate between production and development for
107122
> setting this function.

0 commit comments

Comments
 (0)