resilient-mailer-mailjet
v0.1.2
Published
Mailjet provider implementation for resilient-mailer
Downloads
2
Readme
resilient-mailer-mailjet
resilient-mailer-mailjet
implements Mailjet as an email provider for
resilient-mailer
.
var MailjetProvider = require('resilient-mailer-mailjet');
var mailjet = new MailjetProvider('MyApiKey', 'MyApiSecret');
var mailer; // ResilientMailer instance
mailer.registerProvider(mailjet);
Installation
$ npm install resilient-mailer-mailjet
Usage
Create an instance of the provider. There are also a number of options you can alter:
var MailjetProvider = require('resilient-mailer-mailjet');
var options = {
apiSecure: false, // allows the use of HTTP rather than HTTPS
apiHostname: '127.0.0.1', // allows alternative hostname
apiPort: 8080 // allows unusual ports
};
var mailjet = new MailjetProvider('MyApiKey', 'MyApiSecret', options);
To register the provider with your ResilientMailer
instance:
var mailer; // ResilientMailer instance
mailer.registerProvider(mailjet);
In the event that you want to use MailjetProvider
directly (rather than the
usual way - via ResilientMailer
):
var message = {
from: '[email protected]',
to: ['[email protected]'],
subject: 'Testing my new email provider',
textBody: 'Seems to be working!',
htmlBody: '<p>Seems to be working!</p>'
};
mailjet.send(message, function (error) {
if (!error)
console.log('Success! The message sent successfully.');
else
console.log('Message sending failed - ' + error.message);
});
To see everything available in the message
object, refer to
resilient-mailer.
Testing
Install the development dependencies first:
$ npm install
Then the tests:
$ npm test
Support
Please open an issue on this repository.
Authors
- James Billingham [email protected]
License
MIT licensed - see LICENSE file