1.0.6 • Published 7 years ago

loopback-connector-mailjet v1.0.6

Weekly downloads
5
License
MIT
Repository
github
Last release
7 years ago

loopback-connector-mailjet

Loopback connector module which allow to send emails via Mailjet.

1. Installation

npm install loopback-connector-mailgun --save

2. Configuration

datasources.json

{
    "mailjet": {
        "connector": "loopback-connector-mailjet",
        "apiKey": "${MAILJET_API_KEY}",
        "apiSecret":"${MAILJET_API_SECRET}"
    }
}

model-config.json

{
    "Email": {
        "dataSource": "mailjet",
        "public": false
    }
}

Additionaly you can set defaults

{
    "mailgun": {
        "connector": "loopback-connector-mailgun",
        "apikey": "[your api key here]",
        "default": {
            "fromEmail": "contact@interactive-object.com",
            "fromName": "Anna"
        }
        
    }
}

3. Use

Basic option same as built in Loopback. Returns a Promise

loopback.Email.send({
    to: "to@to.com",
    from: "fron@from.com",
    subject: "subject",
    text: "text message",
    html: "html <b>message</b>",
    headers : {
        "X-My-Header" : "My Custom header"
    }
})
.then(function(response){})
.catch(function(err){});

Basic option for templates

loopback.Email.send({
    to: "to@to.com",
    from: "fron@from.com",
    subject: "subject",
    templateId: "11111",
    templateVars: {
      "VAR": "VALUE"
    }
})
.then(function(response){})
.catch(function(err){});

License

Copyright (c) 2016 Interactive Object . Licensed under the MIT license.

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago