Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@michielgerritsen/email-tester-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.
Installation
npm install --save-dev @michielgerritsen/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