1.0.4 • Published 2 years ago

maildrop v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Installation

npm i maildrop

Type Definitions

type Message = {
  id: string,
  ip: string,
  helo: string,
  date: string,
  mailfrom: string,
  rcptto: string[],
  headerfrom: string,
  subject: string,
  data: string,
  html: string,
};

type Statistics = {
  blocked: number,
  saved: number,
};

function getInbox(mailbox: string): Promise<Omit<Omit<Message, "data">, "html">[] | null>

function getMessage(mailbox: string, id: string): Promise<Message | null>

function getAltInbox(mailbox: string): Promise<string | null>

function getStatistics(): Promise<Statistics | null>

function getStatus(): Promise<string | null>

Usage

// my-file.ts

import maildrop from "maildrop";

const mailbox = "test";

maildrop.getInbox(mailbox).then((inbox) => {
  if (!inbox) return;

  // inbox messages do not contain the "html" and "data" fields
  inbox.forEach((message) => {
    maildrop.getMessage(mailbox, message.id).then((message) => {
      if (!message) return;
      console.log(message);
    });
  });
});

maildrop.getAltInbox(mailbox).then((altinbox) => {
  if (!altinbox) return;
  console.log(altinbox);
});

maildrop.getStatistics().then((statistics) => {
  if (!statistics) return;
  console.log(statistics);
});

maildrop.getStatus().then((status) => {
  if (!status) return;
  console.log(status);
});
1.0.4

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.3

2 years ago

0.0.2

7 years ago

0.0.1

10 years ago