New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

onesecmail

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onesecmail

Create and receive email in only 1 second.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
124
decreased by-48.55%
Maintainers
1
Weekly downloads
 
Created
Source

logo


npm version npm downloads npm install size node version

Create and receive email in only 1 second.

Installation

Warning: This package is native ES modules and does not provide a CommonJS export. If your project uses CommonJS, you will have to convert to ESM or use the dynamic import() function.

Using npm:

npm install onesecmail

Using yarn:

yarn add onesecmail

Using pnpm:

pnpm add onesecmail

Usage

Once the package is installed, you can import the library using import:

import { OneSecMail, OneSecMailAPI } from "onesecmail";

Example

import { OneSecMailAPI } from "onesecmail";

const options = {
  retry: 5,
  timeout: 3000,
};

const api = new OneSecMailAPI(options);

const [email] = await api.genRandomMailbox();

const [login, domain] = email.split("@");

const messages = await api.getMessages(login, domain);

for (const message of messages) {
  const fullMessage = await api.readMessage(login, domain, message.id);
  console.log(fullMessage);
}

API

Options

Options can be passed to the constructor and to each method.

// default options
const options: Partial<Options> = {
  retry: 2, // max retry failed requests
  timeout: 10_000, // milliseconds
};

OneSecMail

Soon...

OneSecMailAPI

This class is an exact reproduction of the official 1secmail.com API.

Create an instance

const api = new OneSecMailAPI();
const api = new OneSecMailAPI(options);

Instance methods

All methods return a Promise.

genRandomMailbox([count[, options]])

count must be between 1 and 500

const emailAddresses = await api.genRandomMailbox(); // same to: genRandomMailbox(1)
const emailAddresses = await api.genRandomMailbox(5);
const emailAddresses = await api.genRandomMailbox(options); // same to: genRandomMailbox(1, options)
const emailAddresses = await api.genRandomMailbox(5, options);
getDomainList([options])
const domainList = await api.getDomainList();
const domainList = await api.getDomainList(options);
getMessages(login, domain[, options])
const messages = await api.getMessages("demo", "1secmail.com");
const messages = await api.getMessages("demo", "1secmail.com", options);
readMessage(login, domain, id[, options])
const message = await api.readMessage("demo", "1secmail.com", 639);
const message = await api.readMessage("demo", "1secmail.com", 639, options);

Returns null if message do not exists.

download(login, domain, id, file[, options])
const file = await api.download("demo", "1secmail.com", 639, "iometer.pdf");
const file = await api.download("demo", "1secmail.com", 639, "iometer.pdf", options);

Returns null if file do not exists.

Keywords

FAQs

Package last updated on 30 Mar 2023

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