https://github.com/lafkpages/1secmail
Creates temporary email accounts that can receive verification emails
https://github.com/lafkpages/1secmail
email mail nodejs tempmail
Last synced: 5 months ago
JSON representation
Creates temporary email accounts that can receive verification emails
- Host: GitHub
- URL: https://github.com/lafkpages/1secmail
- Owner: lafkpages
- Created: 2022-04-14T17:17:20.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-26T10:36:33.000Z (over 2 years ago)
- Last Synced: 2025-04-21T11:07:52.431Z (6 months ago)
- Topics: email, mail, nodejs, tempmail
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 1secmail-api
A NodeJS API for [1secmail.com](https://1secmail.com)
## Examples and usage
The below example creates an email account at `exampleAccount@1secmail.com` and fetches emails every 10 seconds.
```javascript
const { TempMail } = require("1secmail-api");// Create email account
const mail = new TempMail("exampleAccount");// Enable auto-fetching full emails
mail.autoFetch();// Wait until the client is ready
mail.onReady(() => {
// Should show: exampleAccount@1secmail.com
console.log("Email ready! Address:", mail.address);// Get emails every 10 seconds
const fetch = () => {
mail.getMail().then((mails) => {
console.log(mails);mail.deleteMail();
});
};fetch();
setInterval(fetch, 10 * 1000);
});
```You can also chose different domains by passing an extra argument to the `TempMail` constructor:
```javascript
// john@esiix.com
const mail = new TempMail("john", "esiix.com");
```To generate random email addresses use `mail`
```javascript
mail.getRandomAddress();
```To download an attachment use `mail.getAttachment(id, file)` and pass the email ID and the file name.