npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@omx-sdk/email

v1.0.1

Published

Email sending functionality for omx-sdk

Readme

@omx-sdk/email

Email sending functionality for the OMX SDK. This package provides email sending capabilities with support for templates, bulk sending, and delivery tracking.

Installation

npm install @omx-sdk/email
# or
pnpm add @omx-sdk/email

Usage

Basic Email Sending

import { EmailClient, createEmailClient } from '@omx-sdk/email';

// Create an email client
const emailClient = createEmailClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://api.oxinion.com/email', // optional
  defaultFrom: '[email protected]', // optional
  timeout: 10000, // optional
});

// Send a simple email
const result = await emailClient.send({
  to: '[email protected]',
  subject: 'Hello from OMX SDK',
  body: 'This is a test email from the OMX SDK.',
});

console.log('Email sent:', result);

HTML Email with Attachments

const result = await emailClient.send({
  to: ['[email protected]', '[email protected]'],
  from: '[email protected]',
  subject: 'Welcome to Our Service',
  body: 'Welcome! Please see the attached document.',
  html: '<h1>Welcome!</h1><p>Please see the attached document.</p>',
  cc: '[email protected]',
  attachments: [
    {
      filename: 'welcome.pdf',
      content: 'base64-encoded-content',
      contentType: 'application/pdf',
      encoding: 'base64',
    },
  ],
  priority: 'high',
});

Bulk Email Sending

const messages = [
  {
    to: '[email protected]',
    subject: 'Personal Message 1',
    body: 'Hello User 1!',
  },
  {
    to: '[email protected]',
    subject: 'Personal Message 2',
    body: 'Hello User 2!',
  },
];

const results = await emailClient.sendBulk(messages, {
  batchSize: 5, // Send 5 emails at a time
  delay: 1000, // Wait 1 second between batches
});

console.log('Bulk send results:', results);

Template-based Emails

const template = {
  id: 'welcome-template',
  name: 'Welcome Email',
  variables: {
    companyName: 'Oxinion',
    supportEmail: '[email protected]',
  },
};

const result = await emailClient.sendTemplate(template, '[email protected]', {
  userName: 'John Doe',
  activationLink: 'https://app.oxinion.com/activate?token=123',
});

Delivery Tracking

// Get delivery status
const status = await emailClient.getDeliveryStatus('msg_123456789');
console.log('Delivery status:', status);

// Get email statistics
const stats = await emailClient.getStats(
  new Date('2023-01-01'),
  new Date('2023-12-31')
);
console.log('Email stats:', stats);

API Reference

EmailConfig

Configuration object for initializing the EmailClient.

interface EmailConfig {
  apiKey: string; // Required API key
  baseUrl?: string; // Optional base URL
  timeout?: number; // Optional timeout in milliseconds
  defaultFrom?: string; // Optional default from address
}

EmailMessage

Email message object.

interface EmailMessage {
  to: string | string[]; // Recipient(s)
  from?: string; // Sender (optional if defaultFrom is set)
  subject: string; // Email subject
  body: string; // Plain text body
  html?: string; // HTML body (optional)
  cc?: string | string[]; // CC recipients (optional)
  bcc?: string | string[]; // BCC recipients (optional)
  attachments?: EmailAttachment[]; // File attachments (optional)
  replyTo?: string; // Reply-to address (optional)
  priority?: 'high' | 'normal' | 'low'; // Email priority (optional)
}

EmailResponse

Response object from email operations.

interface EmailResponse {
  success: boolean; // Whether the operation succeeded
  messageId?: string; // Unique message identifier (if successful)
  error?: string; // Error message (if failed)
  statusCode?: number; // HTTP status code
}

Methods

  • send(message: EmailMessage): Send a single email
  • sendBulk(messages: EmailMessage[], options?): Send multiple emails
  • sendTemplate(template, recipients, variables?): Send template-based email
  • validateEmail(email: string): Validate email address format
  • getDeliveryStatus(messageId: string): Get delivery status
  • getStats(dateFrom?, dateTo?): Get email statistics
  • getConfig(): Get client configuration

Error Handling

The SDK provides detailed error information for failed operations:

const result = await emailClient.send(message);

if (!result.success) {
  console.error('Email failed:', result.error);
  console.error('Status code:', result.statusCode);
}

License

MIT