Skip to content

Commit d4ebfbe

Browse files
docs
1 parent 80f85b2 commit d4ebfbe

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

README.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
This is an API for the temporary email service [TempMail.lol](https://tempmail.lol).
1010

11-
## If you are using a BananaCrumbs ID/Token and have not migrated, install version 3.1.0!!!
11+
## If you are using a BananaCrumbs ID/Token and have not migrated, install version 3.1.0 instead of 4.x.x!
1212

1313
## Upgrading from 3.1.0
1414

15-
The only difference between 3.1.0 and 4.0.0 is the fact that the constructor only accepts an API Key, and not a BananaCrumbs ID.
15+
The key difference between 3.1.0 and 4.0.0 is the fact that the constructor only accepts an API Key, and not a BananaCrumbs ID.
16+
17+
The custom domain method has changed as well as the createInbox method's parameters.
1618

1719
## Upgrading from 2.0.3
1820

@@ -36,8 +38,8 @@ First, create a TempMail object:
3638
```js
3739
const tempmail = new TempMail();
3840

39-
//if you have a TempMail Plus account, you can add it here:
40-
const tempmail = new TempMail("24-number id", "32-character token");
41+
//if you have a TempMail Plus/Ultra account, you can add it here:
42+
const tempmail = new TempMail("API Key");
4143
```
4244

4345
### Types
@@ -79,18 +81,17 @@ const inbox: Inbox = await tempmail.createInbox();
7981
//there are some advanced options as well
8082

8183
//whether or not to create a community address
82-
const community = true;
83-
tempmail.createInbox(community);
84-
84+
tempmail.createInbox({
85+
community: false,
86+
domain: "cooldomain.com",
87+
prefix: "optional",
88+
});
8589

86-
//or to use a specific domain
87-
const domain = "cringemonster.com";
88-
tempmail.createInbox(false, domain);
8990
```
9091

91-
Note that all inboxes expire after 10 minutes since last check, with a hard expiry limit of one hour that cannot be bypassed.
92+
Note that all inboxes expire after 30 minutes since last check, with a hard expiry limit of one hour that cannot be bypassed.
9293

93-
TempMail Plus subscribers can extend this to TEN hours, but the 10-minute check rule still applies.
94+
TempMail Plus subscribers can extend this to TEN hours, but the 30-minute check rule still applies.
9495

9596
### Retrieve emails
9697

@@ -114,18 +115,32 @@ const emails = tempmail.checkInbox("<TOKEN>").then((emails) => {
114115

115116
### Custom Domains
116117

117-
#### Note: you will need to be a TempMail Plus subscriber to use custom domains!
118+
#### Note: you will need to be a TempMail Plus/Ultra subscriber to use custom domains!
118119

120+
#### Old Custom Domains (v1)
119121
```js
120-
tempmail.checkCustomDomain("example.com", "token").then(emails => {
121-
//woohoo, emails!
122+
tempmail.checkCustomDomainLegacy("example.com", "token").then(emails => {
123+
emails.forEach(e => {
124+
console.log("Email from: " + e.from + " to " + e.to);
125+
});
122126
});
123127
```
124128

125129
You can obtain a token by visiting https://tempmail.lol/custom.html
126130

127131
Custom domains will NOT alert you if the token is invalid.
128132

133+
#### New Custom Domains (v2)
134+
```js
135+
tempmail.checkV2CustomDomain("example.com").then(emails => {
136+
emails.forEach(e => {
137+
console.log("Email from: " + e.from + " to " + e.to);
138+
});
139+
});
140+
```
141+
142+
To setup this, visit your account on https://accounts.tempmail.lol and migrate if you have not already.
143+
129144
### Webhooks
130145

131146
You can set up a webhook to be called when an email is received.

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class TempMail {
9494
*/
9595
async checkCustomDomainLegacy(domain: string, token: string): Promise<Email[]> {
9696

97-
const r = await this.makeRequest(`/custom/${token}/${domain}`);
97+
const r = await fetch(`https://api.tempmail.lol/custom/${token}/${domain}`);
9898

9999
let emails: Email[];
100100

0 commit comments

Comments
 (0)