The Official OhMySMTP Blog

Send transactional emails with Node.js over OhMySMTP

February 04, 2021

Weโ€™re pleased to announce the availability of our open source Node.js package for sending emails over OhMySMTP.

This is probably the easiest way to send transactional emails from Node.js!

The npm package allows you to send emails in a couple of lines of code, itโ€™s a simple as creating a client with your API token, and calling sendEmail with your email contents (see here for a full list of email properties: https://docs.ohmysmtp.com/reference/send):

const OhMySMTP = require('@ohmysmtp/ohmysmtp.js');
const client = new OhMySMTP.DomainClient('API_TOKEN_HERE');

client.sendEmail({
    from: 'test@test.com',
    to: 'test@test.com',
    subject: 'test',
    htmlbody: '<H1>HTML Email</h1>',
  });

The package is available on npm here: https://www.npmjs.com/package/@ohmysmtp/ohmysmtp.js

Source code here: https://github.com/ohmysmtp/ohmysmtp.js

And finally the docs: https://docs.ohmysmtp.com/integrations/node

If you donโ€™t have an OMS account, get one set up today: https://app.ohmysmtp.com/users/sign_up

Happy sending! Paul.


Written by Paul
Follow me on Twitter