# flow-mailjet-component

> Mailjet component designed to work with Flow SDK

Latest version **0.6.3** (published 2019-03-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install flow-mailjet-component
pnpm add flow-mailjet-component
yarn add flow-mailjet-component
bun add flow-mailjet-component
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.6.3 |
| Published | 2019-03-10 |
| First published | 2018-12-26 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 26.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Hackerbay Inc. |
| Maintainers | hackerbayadmin |

## Links

- npm: https://www.npmjs.com/package/flow-mailjet-component
- Repository: https://github.com/FlowAppPlatform/flow-mailjet-component
- Homepage: https://github.com/FlowAppPlatform/flow-mailjet-component#readme
- Issues: https://github.com/FlowAppPlatform/flow-mailjet-component/issues
- npm.io page: https://npm.io/package/flow-mailjet-component

## Dependencies (4)

- [cross-env](https://npm.io/package/cross-env.md) ^5.2.0
- [node-mailjet](https://npm.io/package/node-mailjet.md) ^3.2.1
- [email-validator](https://npm.io/package/email-validator.md) ^2.0.4
- [flow-platform-sdk](https://npm.io/package/flow-platform-sdk.md) ^1.3.1

## Recent versions

- 0.6.3 (latest) — 2019-03-10
- 0.6.1 — 2019-02-15
- 0.5.7 — 2018-12-26

## README

# Flow Mailjet component
The component sends email using Mailjet and is designed to work with Flow SDK

*To get started, install the package in your NodeJS project*

```
npm i flow-mailjet-component --save
```

*Use the component as below*

```javascript
// require the component
const Component = require('flow-mailjet-component');

// create instance of the component
const component = new Component();
```

*Provide mailjet credentials, public and private api keys*

```javascript
component.getProperty('API_KEY_PUBLIC').data = 'Your_Public_Mailjet_Key';
component.getProperty('API_KEY_PRIVATE').data = 'Your_Private_Mailjet_Key';
```

*Provide email fields*

```javascript
// provide from and to address of the email
component.getProperty('From').data = 'fro@domain';
component.getProperty('To').data = 'to@domain';

// provide the subject and body for the email
component.getProperty('Subject').data = 'Checking your availability';
component.getProperty('Body').data = 'Hello, Merrari.';
```

*Listen in for port emit events*
```javascript
component.getPort('Sent').onEmit(function(){
  // email was sent
  // the server response can be accessed through the 'Data' property of the port
  let response = component.getPort('Sent').getProperty('Data').data;
});

component.getPort('Bounced').onEmit(function(){
  // email bounced
  // the actual error can be accessed through the 'Data' property of the port
  let err = component.getPort('Bounced').getProperty('Data').data;
});

component.getPort('Error').onEmit(function(){
  // a seperate error occured
  // the actual error can be accessed through the 'Data' property of the port
  let err = component.getPort('Error').getProperty('Data').data;
});
```

*Execute the component*
```javascript
// add the component to a graph before executing it
const Graph = require('flow-platform-sdk').Graph;
new Graph("graph-1").addComponent(component);

component.execute();
```

#### Conclusion

If you are having trouble sending emails, check that you are using the correct [Mailjet API keys](https://app.mailjet.com/account/setup) and the right [sender address](https://app.mailjet.com/account/sender).

---
_Source: https://npm.io/package/flow-mailjet-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
