Skip to content

Create a unified API to acccess messages in SMTP testing software like Mailhog and Mailcatcher.

Notifications You must be signed in to change notification settings

aidalinfo/email-tester-api

 
 

Repository files navigation

This package provides a unified API to access messages in SMTP testing software like Mailhog and Mailcatcher. This is intended to be used with Cypress. (Original Repo : https://github.com/michielgerritsen/email-tester-api)

Installation

npm install --save-dev email-tester-api

Configuration

Mailhog

const emailApi = new EmailTesterApi('mailhog', {
    baseUrl: 'https://mailhog.test/'
});

Mailcatcher

const emailApi = new EmailTesterApi('mailcatcher', {
    baseUrl: 'https://mailcatcher.test/'
});

Usage

When you have an initialized emailApi object, you can access the last message like this:

const message = await emailApi.getLastMessage();

This will return a DomDocument object. This allows you to access the contents of the message like this:

message.contents.querySelector('a[target="_blank"]').href

Fork Repo

Original Repo : https://github.com/michielgerritsen/email-tester-api

About

Create a unified API to acccess messages in SMTP testing software like Mailhog and Mailcatcher.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%