Cliam: agnostic email sending in Node.js

Steve LebleuSteve Lebleu
2 min read

As a developer, email sending is a recurent task across the projects.

Most part of time, you have to deal with open source libraries, to switch from a library to another accross the projects, with some particular implementations and / or behaviors.

As well, you can have a different need inside a same project just regarding the use case.

For example, you can still need to send an email to a developer when a particular event is fired, or send a transactionnal email to say welcome to a new user.

In the first case, a simple SMTP server can do the job internally.

In the second case, it's more efficient to rely to a web API, able to manage statistics, bouncing, DKIM, templating, ...

As well, you can need to deal with different providers at the same time. During a migration, for example.

Some months ago, I was wondering how to provide something flexible and consistent to deal with this kind of repetitive issue.

And I did it myself, because it was quite fun.

All the cases described above - and some others - are covered by a light NPM package.

The main features are:

  • Configuration based

  • Agnostic appoach: same input, same output for all configurations

  • Formalized transactions conventions

  • Unlimited number of transporters inside the same project

  • Support of different sending modes (SMTP and web API)

  • Embeded view engine, stream or web API templates

There is Cliam, an agnostic and very flexible tool to deal with transactional email sending.

Currently, following web api providers are supported: Mailgun, Mailjet, Brevo, Sendinblue, Sendgrid, Mandrill, Sparkpost, Mailsender and Postmark. Amazon SES and a lot of others should be integrated soon, but I prefer take the focus on some new features and to push more robustness before to embedd too much transporters.

Have a good dev, enjoy and feel free to use.

0
Subscribe to my newsletter

Read articles from Steve Lebleu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Steve Lebleu
Steve Lebleu

Freelance full stack developer, cross triathlete and nature lover.