This is an API for the temporary email service TempMail.lol.
npm i tempmail.lol
# or, if you use yarn
yarn add tempmail.lol
This has built-in types.
To create an inbox, you can use one of the following two functions:
//with callback
createInbox((inbox) => {
console.log(`Created new inbox: ${inbox.address}, token: ${inbox.token}`);
});
//async
createInboxAsync().then((inbox) => {
console.log(`Created new inbox: ${inbox.address}, token: ${inbox.token}`);
});
//await
const inbox = await createInboxAsync();
To get the emails (you can also pass in the Inbox object instead of a token string):
//with callback
checkInbox("token", (emails) => {
emails.forEach((e) => {
console.log(JSON.stringify(e, null, 4));
});
});
//async
checkInboxAsync("token").then((emails) => {
emails.forEach((e) => {
console.log(JSON.stringify(e, null, 4));
});
});
//await
const emails = await checkInboxAsync("token");