diff --git a/README.md b/README.md index 8465f2b..663db4a 100644 --- a/README.md +++ b/README.md @@ -57,22 +57,9 @@ Define a minimalist configuration in *.cliamrc.json* newly created: ```json { "sandbox": true, - "variables": { - "domain": "https://www.my-website.com", - "addresses": { - "from": { - "name": "John Doe", - "email": "info@john.doe.com" - }, - "replyTo": { - "name": "John Doe", - "email": "info@john.doe.com" - } - } - }, "transporters": [ { - "id": "unique-key-for-my-transporter", + "id": "unique-transporter-key", "mode": "smtp", "auth": { "username": "USERNAME", @@ -83,6 +70,19 @@ Define a minimalist configuration in *.cliamrc.json* newly created: "port": 587, "secure": false } + }, + { + "id": "other-unique-transporter-key", + "mode": "api", + "provider": "sendgrid", + "auth": { + "apiKey": "APIKEY", + }, + "options": { + "templates": { + "user.welcome": "d-321bb40f548e4db8a628b4d6464ebacc" + } + } } ] } @@ -97,7 +97,24 @@ import { Cliam } from 'cliam'; // Do some stuffs ... -Cliam.mail('user.confirm', payload) +const payload = { + meta: { + from: { email: 'john.doe@hotmail.com' }, + to: [ + { email: 'john.allan.poe@hotmail.com' } + ], + replyTo: { email: 'john.doe@hotmail.com' }, + subject: 'Welcome John' + } + content: [ + { + type: 'text/html', + value: '
I use Cliam to send my emails !
' + } + ] +}; + +Cliam.mail('user.welcome', payload) .then(res => { console.log('Email has been delivered: ', res); }) @@ -106,6 +123,8 @@ Cliam.mail('user.confirm', payload) }); ``` +By default, Cliam will use the first transporter found in the cliamrc file, except if you precise wich transporterId you want to use on the fly. + See [request payload](https://github.com/steve-lebleu/cliam/wiki/Inputs) wiki section for more information about availables options and configurations.