# rabbitmq-email-manager

> A light-weight helper class that uses amqplib to send emails via nodemailer. Note!! This is a personal module developed for code re-usability.

Latest version **1.0.23** (published 2022-08-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install rabbitmq-email-manager
pnpm add rabbitmq-email-manager
yarn add rabbitmq-email-manager
bun add rabbitmq-email-manager
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.23 |
| Published | 2022-08-15 |
| First published | 2022-08-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| Author | Uchenna Nnochirionye |
| Maintainers | uchepercynnoch |

## Links

- npm: https://www.npmjs.com/package/rabbitmq-email-manager
- npm.io page: https://npm.io/package/rabbitmq-email-manager

## Dependencies (7)

- [amqplib](https://npm.io/package/amqplib.md) ^0.10.2
- [ts-node](https://npm.io/package/ts-node.md) ^10.9.1
- [nodemailer](https://npm.io/package/nodemailer.md) ^6.7.7
- [typescript](https://npm.io/package/typescript.md) ^4.7.4
- [@types/node](https://npm.io/package/@types/node.md) ^18.7.1
- [@types/amqplib](https://npm.io/package/@types/amqplib.md) ^0.8.2
- [@types/nodemailer](https://npm.io/package/@types/nodemailer.md) ^6.4.5

## Recent versions

- 1.0.23 (latest) — 2022-08-15
- 1.0.22 — 2022-08-15
- 1.0.21 — 2022-08-14
- 1.0.2 — 2022-08-14
- 1.0.1 — 2022-08-14
- 1.0.0 — 2022-08-14

## README

### A light-weight amqplib class helper to send emails via nodemailer.

### This module was developed to help with code re-usability in a project.

### If You find it helpful, by all means install and use.

### Before you use, kindly pass a reference to amqplib client and nodemailer transporter, in the entry point of your app.

__main.js__

```
  import { QueueManager } from "rabbitmq-email-manager";
  
  import queue from "./queue";
  import smtp from "./smtp";
  import { QUEUE_EVENTS } from "./constants";

  await QueueManager.init({
    queueClient: queue.client,
    smtpClient:smtp.client,
    queue: QUEUE_EVENTS.name,
  });
  
  //If you want to consume published messages on same app
  await QueueManager.consume({ logging:true });
```

__controller.js__

```
  import { QueueManager } from "rabbitmq-email-manager";
  
    await QueueManager.publish({
      data: {
        to: email,
        from: {
          name: process.env.SMTP_EMAIL_FROM_NAME,
          address: process.env.SMTP_EMAIL_FROM,
        },
        subject: "Mail Subject",
        bcc: [
          process.env.SMTP_CUSTOMER_CARE_EMAIL,
          process.env.SMTP_EMAIL_FROM,
        ],
        html: mailHtml
      },
    });
```

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