https://github.com/paralect/email-service
https://github.com/paralect/email-service
email email-sending paralect-stack
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/paralect/email-service
- Owner: paralect
- License: mit
- Created: 2018-05-31T11:28:07.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-01-14T11:06:40.000Z (over 4 years ago)
- Last Synced: 2024-10-31T18:59:21.292Z (7 months ago)
- Topics: email, email-sending, paralect-stack
- Language: JavaScript
- Size: 20.5 KB
- Stars: 4
- Watchers: 12
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Email service
[](https://github.com/paralect/stack)
[](#contributors)
[](https://badge.fury.io/js/%40paralect%2Femail-service)
[](LICENSE)
[](http://makeapullrequest.com)
[](http://product-stack-ci.paralect.com/paralect/email-sercice)
[](https://david-dm.org/paralect/email-service)
[](https://coveralls.io/github/paralect/email-service?branch=master)[](https://github.com/paralect/email-service/watchers)
[](https://github.com/paralect/email-service/stargazers)
[](https://twitter.com/paralect)
[](https://twitter.com/intent/tweet?text=I%27m%20using%20Stack%20components%20to%20build%20my%20next%20product%20🚀.%20Check%20it%20out:%20https://github.com/paralect/stack)Email service is using [mailgun node client](https://www.npmjs.com/package/mailgun-js) to send emails.
We are inspired by [mjml](https://github.com/mjmlio/mjml) project. So, you can use mjml in your project and
after compiling templates to simple html files use our project to inject params by handlebars and send emails.
Let's dive into the docs.## Installation
```
npm i @paralect/email-service
```## Quick example
To create a MailService class you should provide several params to its constructor
```javascript
const MailService = require('@paralect/email-service');const mailService = new MailService({
isSendEmail: false, // you can prevent email sending by this param
savedEmailHtmlPath: __dirname, // if you want to save your email as html in development mode
mailgun: { // configs for https://www.npmjs.com/package/mailgun-js
apiKey: 'test',
domain: 'test.info',
},
templatesDir: __dirname, // absolute path to templates directory
});
```After that you are able to run **send** method with several params
```javascript
const result = await mailService.send(
'email.html',
{ name: 'User name' },
{
from: 'Excited User ',
to: '[email protected]',
subject: 'Test email',
}
);
```## Full API Reference
[API Reference](https://github.com/paralect/email-service/blob/master/API.md).
## Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
Every release is documented on the Github [Releases](https://github.com/paralect/email-service/releases) page.## License
Email-service is released under the [MIT License](https://github.com/paralect/email-service/blob/master/LICENSE).
## Contributing
Please read [CONTRIBUTING.md](https://github.com/paralect/email-service/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
## Contributors
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
| [
KuhArt](https://github.com/KuhArt)
[💻](https://github.com/paralect/email-service/commits?author=KuhArt "Code") [📖](https://github.com/paralect/email-service/commits?author=KuhArt "Documentation") [🤔](#ideas-KuhArt "Ideas, Planning, & Feedback") [🎨](#design-KuhArt "Design") | [
Evgeny Zhivitsa](https://github.com/ezhivitsa)
[💻](https://github.com/paralect/email-service/commits?author=ezhivitsa "Code") [📖](https://github.com/paralect/email-service/commits?author=ezhivitsa "Documentation") |
| :---: | :---: |This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!