# le-poste

> a mail wrapper to forget about essential details of life

Latest version **0.0.7** (published 2025-09-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install le-poste
pnpm add le-poste
yarn add le-poste
bun add le-poste
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

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

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2025-09-22 |
| First published | 2022-02-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 50 KB |
| Known vulnerabilities | 0 (+20 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Guillermo Pages |
| Maintainers | guillermo_at |

## Links

- npm: https://www.npmjs.com/package/le-poste
- Repository: https://github.com/gbili/le-poste
- Homepage: https://github.com/gbili/le-poste#readme
- Issues: https://github.com/gbili/le-poste/issues
- npm.io page: https://npm.io/package/le-poste

## Dependencies (4)

- [di-why](https://npm.io/package/di-why.md) ^0.18.0
- [dotenv](https://npm.io/package/dotenv.md) ^17.2.2
- [nodemailer](https://npm.io/package/nodemailer.md) ^7.0.6
- [swiss-army-knifey](https://npm.io/package/swiss-army-knifey.md) ^1.36.4

## Recent versions

- 0.0.7 (latest) — 2025-09-22
- 0.0.6 — 2025-06-19
- 0.0.5 — 2024-12-04
- 0.0.4 — 2024-12-02
- 0.0.3 — 2024-12-02
- 0.0.2 — 2022-11-22
- 0.0.1 — 2022-02-23

## README

# `Le Poste`

A simple interface to send emails.

![code coverage](https://img.shields.io/codecov/c/github/gbili/le-poste.svg)
![version](https://img.shields.io/npm/v/le-poste.svg)
![downloads](https://img.shields.io/npm/dm/le-poste.svg)
![license](https://img.shields.io/npm/l/le-poste.svg)

## Installation

To install this `npm` package do

```sh
npm i le-poste
```

## Usage

This package is interesting if you are using a dependency injector like `di-why`, combined with `dotenv` to just plug the env variables and play. So this will describe usage along with these two packages.

Go to your usual `loaders` directory `index.ts` and import `mailInjectionDict`

```js
// your-project/src/loaders/index.ts
import DiContainer from 'di-why';
// import any other dict elements ...
// and
import { mailInjectionDict } from 'le-poste';

const injectionDict = {
  // somePackageLoadDict,
  // etc.,
  // finally inject all le-poste's loaders into the main loadDict
  ...mailInjectionDict,
};

const di = new DiContainer({ logger, load: injectionDict });
export default di;
```

Now you can go anywhere in your code and import the index file above:

```ts
import di from `./loaders`;
try {
  await di.loadAll();
  const mailSend = di.get('mailSend');
  await mailSend({ subject: "le poste is open", text: "Tu reçois my message" });
} catch (e) {
  console.log('Some error occurred', e);
}
```

Lots of magic happening here, thanks to `di-why` and the `mailInjectionDict` we imported. That's why you need not pass `user`, `password`, `port` and `transporter` stuff in order to send a message.

A question emerges, how do we pass the connection data to `mailSend` ? We don't do it directly. Read on.

## Passing connection info

In order to configure mailSend, we need to be using `dotenv`, or add some properties to `process.env`. They are the following:

```env
MAIL_SMTP_HOST=mail.yourmailprovider.com
MAIL_SMTP_PORT=465
MAIL_FROM_NAME="Jean Jacques"
MAIL_USER=jj@cousteau.com
MAIL_ADMIN_TO_COMMA_LIST="Notify Me Aswell" <admin@cousteau.com>
MAIL_TO_COMMA_LIST="Le phare" <le@phare.com>
MAIL_PASSWORD='s0meR4nd0mCh4r5'
```

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