
Security News
Deno Goes the Way of the Dinosaur
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.
Official Emailr API SDK for TypeScript/JavaScript.
npm install @emailr/sdk
# or
pnpm add @emailr/sdk
# or
yarn add @emailr/sdk
import { Emailr } from '@emailr/sdk';
const emailr = new Emailr({ apiKey: 'your-api-key' });
// Send an email
const result = await emailr.emails.send({
to: 'recipient@example.com',
from: 'sender@yourdomain.com',
subject: 'Hello!',
html: '<h1>Hello World</h1>',
});
console.log(result.message_id);
const emailr = new Emailr({
apiKey: 'your-api-key',
baseUrl: 'https://api.emailr.dev', // optional
timeout: 30000, // optional, in milliseconds
});
// Send an email
const result = await emailr.emails.send({
to: 'recipient@example.com',
from: 'sender@yourdomain.com',
subject: 'Hello!',
html: '<h1>Hello World</h1>',
text: 'Hello World',
});
// Send with a template
const result = await emailr.emails.send({
to: 'recipient@example.com',
template_id: 'template-uuid',
template_data: { name: 'John', company: 'Acme' },
});
// Get email by ID
const email = await emailr.emails.get('email-uuid');
// List emails
const emails = await emailr.emails.list({ page: 1, limit: 50 });
// Create a contact
const contact = await emailr.contacts.create({
email: 'contact@example.com',
first_name: 'John',
last_name: 'Doe',
metadata: { source: 'website' },
});
// List contacts
const contacts = await emailr.contacts.list({ limit: 100 });
// Update a contact
const updated = await emailr.contacts.update('contact-uuid', {
first_name: 'Jane',
});
// Delete a contact
await emailr.contacts.delete('contact-uuid');
// Bulk create contacts
const result = await emailr.contacts.bulkCreate({
contacts: [
{ email: 'user1@example.com', first_name: 'User 1' },
{ email: 'user2@example.com', first_name: 'User 2' },
],
});
// Create a template
const template = await emailr.templates.create({
name: 'Welcome Email',
subject: 'Welcome to {{company}}',
html_content: '<h1>Welcome {{name}}</h1>',
variables: ['name', 'company'],
});
// List templates
const templates = await emailr.templates.list();
// Update a template
const updated = await emailr.templates.update('template-uuid', {
subject: 'New Subject',
});
// Delete a template
await emailr.templates.delete('template-uuid');
// Add a domain
const domain = await emailr.domains.add({ domain: 'example.com' });
// List domains
const domains = await emailr.domains.list();
// Verify domain
const status = await emailr.domains.verify('domain-uuid');
// Check DNS status
const dnsStatus = await emailr.domains.checkDns('domain-uuid');
// Delete a domain
await emailr.domains.delete('domain-uuid');
// Create a webhook
const webhook = await emailr.webhooks.create({
name: 'Email Events',
url: 'https://api.example.com/webhooks',
events: ['email.sent', 'email.delivered', 'email.bounced'],
});
// List webhooks
const webhooks = await emailr.webhooks.list();
// Enable/disable webhook
await emailr.webhooks.enable('webhook-uuid');
await emailr.webhooks.disable('webhook-uuid');
// Delete a webhook
await emailr.webhooks.delete('webhook-uuid');
// Create a broadcast
const broadcast = await emailr.broadcasts.create({
name: 'Newsletter - January',
subject: 'Your monthly update',
from_email: 'newsletter@example.com',
segment_id: 'segment-uuid',
html_content: '<h1>Newsletter</h1>',
});
// Send a broadcast
const result = await emailr.broadcasts.send('broadcast-uuid');
// Schedule a broadcast
await emailr.broadcasts.schedule('broadcast-uuid', '2024-01-15T10:00:00Z');
// Cancel a scheduled broadcast
await emailr.broadcasts.cancel('broadcast-uuid');
// Create a segment
const segment = await emailr.segments.create({
name: 'Active Users',
description: 'Users who opened an email in the last 30 days',
conditions: { opened_email: { within_days: 30 } },
});
// List segments
const segments = await emailr.segments.list();
// Get contacts in a segment
const contacts = await emailr.segments.getContacts('segment-uuid');
// Get segment count
const count = await emailr.segments.getCount('segment-uuid');
import { Emailr, EmailrError, ValidationError, RateLimitError } from '@emailr/sdk';
try {
await emailr.emails.send({ to: 'invalid-email' });
} catch (error) {
if (error instanceof ValidationError) {
console.error('Validation failed:', error.message, error.details);
} else if (error instanceof RateLimitError) {
console.error('Rate limited. Retry after:', error.retryAfter, 'seconds');
} else if (error instanceof EmailrError) {
console.error('API error:', error.message, error.statusCode, error.code);
}
}
This SDK is written in TypeScript and provides full type definitions for all API requests and responses.
import type { SendEmailRequest, Email, Contact } from '@emailr/sdk';
const request: SendEmailRequest = {
to: 'recipient@example.com',
subject: 'Hello',
html: '<h1>Hello</h1>',
};
MIT
FAQs
Official Emailr API SDK for TypeScript/JavaScript
The npm package emailr receives a total of 0 weekly downloads. As such, emailr popularity was classified as not popular.
We found that emailr 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.

Security News
Cloudflare is acquiring Deno’s team, which will provide another year of bug fixes and security updates before ending support for the runtime.

Security News
Anthropic’s free OSS Scanner uses Mythos and other Claude models to find open source vulnerabilities and send maintainers reports with proposed fixes.

Security News
On Front Lines’ Early Adopters: CISO podcast, Andrew Becherer shares lessons from Datadog, weighs the long-term costs of AI-built tools, and explains how founders can actually gain a CISO’s trust.