
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
cloudmailin
Advanced tools
Official Node.js for the CloudMailin Email API - https://www.cloudmailin.com
A Node.JS SDK for CloudMailin written in Typescript for receiving incoming email via JSON HTTP POST.
Please see the Documentation for more details and examples.
You can install the library using NPM.
npm install cloudmailin
We recommend you take a look at our Documentation for a more detailed example but here's a snippet:
import express from "express";
import bodyParser from "body-parser";
import { IncomingMail } from "cloudmailin";
const app = express();
app.use(bodyParser.json());
app.post("/incoming_mails/", (req, res) => {
const mail = <IncomingMail>req.body;
res.status(201).json(mail);
}
You can initialize the MessageClient in two ways:
import { MessageClient } from "cloudmailin"
const client = new MessageClient({
username: "your-username",
apiKey: "your-api-key"
});
const response = await client.sendMessage({
to: 'test@example.net',
from: 'test@example.com',
plain: 'test message',
html: '<h1>Test Message</h1>',
subject: "hello world"
});
You can provide the SMTP URL either as an option or via environment variable:
Option 1: Pass smtpUrl directly
import { MessageClient } from "cloudmailin"
const client = new MessageClient({
smtpUrl: "smtp://username:apikey@smtp.cloudmta.net:587?starttls=true"
});
const response = await client.sendMessage({
to: 'test@example.net',
from: 'test@example.com',
plain: 'test message',
html: '<h1>Test Message</h1>',
subject: "hello world"
});
Option 2: Use environment variable
export CLOUDMAILIN_SMTP_URL="smtp://username:apikey@smtp.cloudmta.net:587?starttls=true"
import { MessageClient } from "cloudmailin"
const client = new MessageClient(); // Will automatically use CLOUDMAILIN_SMTP_URL
const response = await client.sendMessage({
to: 'test@example.net',
from: 'test@example.com',
plain: 'test message',
html: '<h1>Test Message</h1>',
subject: "hello world"
});
Note: The SMTP URL format is smtp://username:apikey@host:port?params.
The host and port in the URL are not used for the API calls - the library
automatically uses the correct CloudMailin API endpoint at
https://api.cloudmailin.com/api/v0.1/{username}/messages.
Generating the OpenAPI reference:
npx openapi-typescript ./path_to/api.yaml --output ./src/models/cloudmailin-api.ts
[0.2.0] - 2025-09-16
CLOUDMAILIN_SMTP_URL environment variablesmtpUrl directly as an option in MessageClientOptionsMessageClientOptions (where all fields are now optional)FAQs
Official Node.js for the CloudMailin Email API - https://www.cloudmailin.com
The npm package cloudmailin receives a total of 5,381 weekly downloads. As such, cloudmailin popularity was classified as popular.
We found that cloudmailin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.