Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emailonacid-client

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emailonacid-client

Client for EmailOnAcid REST API Service

  • 3.9.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Email-On-Acid Client

This modules is a client for Email on Acid service for testing emails.

Environment requirements

This module works in Node and Web environments

This module requires Node 7.6.0+ because of async/await syntax. For the browser, make sure to polyfill Promise, transpile arrow functions and async/await syntax. This module also includes fetch and atob/btoa API polyfills to be server- & client- side ready.

Installation

# yarn
yarn add emailonacid-client

# npm
npm install --save emailonacid-client

Usage

const createClient = require('emailonacid-client');

/**
 * Make sure to catch rejections from client
 */
try {
  /**
   * Create a new client instance, this will validate credentials as well.
   * Please note that every API method is async and returns a Promise.
   *
   * It is recommended to store API Key and Account Password in env variables
   * for security reasons. Check `dotenv` module for comfortable env vars management.
   */
  const client = createClient({
    // Required, your API Key
    apiKey: process.env.EOA_API_KEY,
    // Required, your account password
    accountPassword: process.env.EOA_ACCOUNT_PASSWORD,
    // Optional, base Rest API URL. Defaults to value below.
    apiBaseUrl: 'https://api.emailonacid.com/v5',
    // Optional, list of clients to test. Defaults to value below.
    clients: ['iphone6p_9', 'gmail_chr26_win', 'outlook16'],
  });
  /**
   * Example: creating new test.
   * Tests are stored for 90 days and would resolve previous (if any) cached result
   * if all options are same. Mails sent via utf8 encoding.
   */
  const freshlyCreatedTest = await client.createTest({
    // Required, mail's subject to test
    subject: 'Hello'
    // Required, mail's markup
    html: '<p>Hello there</p>',
    // Optional, flag to block images or not. Defaults to value below.
    shouldBlockImages: false,
  });
  console.log(freshlyCreatedTest.id); // -> unqie id generated by EmailOnAcid
} catch (error) {
  console.error(error);
}

This module also keeps static information about list of available clients. Please keep in mind that it's collected on publish step and might be out-of-date.

const { clients } = require('emailonacid-client');
console.log(clients); // <- array with available clients

Testing

yarn test

Publishing

yarn publish

FAQs

Package last updated on 29 May 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc