
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Mailisk is an end-to-end email testing platform. It allows you to receive emails with code and automate email tests.
For a more step-by-step walkthrough see the NodeJS Guide.
npm install --save-dev mailisk
yarn add mailisk --dev
After installing the library import it and set the API Key
const { MailiskClient } = require("mailisk");
// create client
const mailisk = new MailiskClient({ apiKey: "YOUR_API_KEY" });
// send email (using virtual SMTP)
await client.sendVirtualEmail(namespace, {
from: "test@example.com",
to: `john@${namespace}.mailisk.net`,
subject: "Testing",
text: "This is a test.",
});
// receive email
const result = await client.searchInbox(namespace);
console.log(result);
This library wraps the REST API endpoints. Find out more in the API Reference.
The searchInbox
function takes a namespace and call parameters.
wait
property by default. This means the call won't timeout until a result is returned or 5 minutes pass. This is adjustable by passing the timeout
paramter (it can also be disabled by passing wait: false
).from_timestamp
of current timestamp - 5 seconds. This means that older emails will be ignored. This can be overriden by passing the from_timestamp
parameter (from_timestmap: 0
will disable filtering by email age).A common use case is filtering the returned emails by the destination address, this is done using the to_addr_prefix
parameter.
const { data: emails } = await mailisk.searchInbox(namespace, {
to_addr_prefix: "john@mynamespace.mailisk.net",
});
For more parameter options see the endpoint reference.
Send an email using Virtual SMTP. This will fetch the SMTP settings for the selected namespace and send an email. These emails can only be sent to an address that ends in @{namespace}.mailisk.net
.
const namespace = "mynamespace";
await mailisk.sendVirtualEmail(namespace, {
from: "test@example.com",
to: `john@${namespace}.mailisk.net`,
subject: "This is a test",
text: "Testing",
});
This does not call an API endpoint but rather uses nodemailer to send an email using SMTP.
List all namespaces associated with the current API Key.
const namespacesResponse = await mailisk.listNamespaces();
// will be ['namespace1', 'namespace2']
const namespaces = namespacesResponse.map((nr) => nr.namespace);
FAQs
Mailisk library for NodeJS
The npm package mailisk receives a total of 7,705 weekly downloads. As such, mailisk popularity was classified as popular.
We found that mailisk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.