Package Exports
- send16-mail
Readme
Send16 - Email for Developers
The official Node.js SDK for Send16 — transactional and marketing email that just works. Built with TypeScript, works in Node.js, Deno, Bun, and edge runtimes.
Get Your API Key
Create a free account at send16.com/register to get your API key. The free plan includes 1,000 emails/month.
Once registered, go to Developers > API Keys in the dashboard to generate your sk_live_ key.
Installation
npm install send16-mailQuick Start
import { Send16 } from 'send16-mail';
// Get your API key at https://send16.com/register
const send16 = new Send16('sk_live_your_api_key_here');
const { data, error } = await send16.emails.send({
from: 'Acme <hello@yourdomain.com>',
to: ['user@gmail.com'],
subject: 'Hello from Send16',
html: '<p>Hello world</p>',
});
if (error) {
console.error('Failed:', error.message);
} else {
console.log('Sent:', data.id);
}Why Send16?
- Simple API - Resend-compatible interface, easy to switch
- Self-hosted option - Run on your own server for full control
- Transactional + Marketing - One platform for all your email
- Free tier - 1,000 emails/month, no credit card required
- TypeScript-first - Full type safety out of the box
Configuration
const send16 = new Send16('sk_live_your_key', {
baseUrl: 'https://api.send16.com', // default
timeout: 30000, // default: 30s
});Emails
Send an email
const { data, error } = await send16.emails.send({
from: 'Acme <hello@acme.com>',
to: ['user@gmail.com'],
subject: 'Hello',
html: '<p>Hello world</p>',
});All options
const { data, error } = await send16.emails.send({
from: 'Acme <hello@acme.com>',
to: ['user@gmail.com'],
cc: ['cc@example.com'],
bcc: ['bcc@example.com'],
replyTo: 'support@acme.com',
subject: 'Invoice #1234',
html: '<p>Your invoice is attached.</p>',
text: 'Your invoice is attached.',
headers: { 'X-Custom-Header': 'value' },
attachments: [
{
filename: 'invoice.pdf',
content: '<base64-encoded>',
contentType: 'application/pdf',
},
],
tags: [{ name: 'category', value: 'invoices' }],
scheduledAt: '2026-04-01T09:00:00Z',
});Batch send (up to 100)
const { data, error } = await send16.emails.batch([
{ from: 'Acme <hi@acme.com>', to: ['alice@example.com'], subject: 'Hi Alice', html: '<p>Hi!</p>' },
{ from: 'Acme <hi@acme.com>', to: ['bob@example.com'], subject: 'Hi Bob', html: '<p>Hi!</p>' },
]);Contacts
// Create
const { data } = await send16.contacts.create({ email: 'user@test.com', firstName: 'John' });
// List
const { data } = await send16.contacts.list({ page: 1, limit: 50 });
// Update
const { data } = await send16.contacts.update('id', { firstName: 'Jane' });
// Delete
const { data } = await send16.contacts.delete('id');Domains
// List
const { data } = await send16.domains.list();
// Verify DNS
const { data } = await send16.domains.verify('domain-id');Error Handling
The SDK never throws. Every method returns { data, error }:
const { data, error } = await send16.emails.send({ ... });
if (error) {
console.error(error.code); // "HTTP_422", "TIMEOUT", "NETWORK_ERROR"
console.error(error.message);
return;
}
console.log(data.id); // data is guaranteed non-nullTypeScript
import type { SendEmailPayload, SendEmailResponse, Contact, Domain } from 'send16-mail';Links
- Dashboard - Manage your account
- Create Account - Get your free API key
- Documentation - API docs and guides
License
MIT