Socket
Book a DemoInstallSign in
Socket

le-poste

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

le-poste

a mail wrapper to forget about essential details of life

0.0.6
latest
Source
npmnpm
Version published
Weekly downloads
42
180%
Maintainers
1
Weekly downloads
 
Created
Source

Le Poste

A simple interface to send emails.

code coverage version downloads license

Installation

To install this npm package do

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

// 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:

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:

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'

FAQs

Package last updated on 19 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.