-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
31 lines (25 loc) · 1 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import MiabClient from "miabclient";
// Initialize the client
const client = new MiabClient('https://your-domain.com', '[email protected]', 'your-password');
async function main() {
// Create a mailbox
const mailbox = await client.createMailbox('your-domain.com'
// 'username', // optional
// 'password' // optional
);
console.log(mailbox); // { success: true, email: '[email protected]', password: 'password' }
// Get emails
const emails = await client.getEmails(mailbox.email, mailbox.password);
console.log(emails); // { success: true, response: [ { ... }, { ... }, ... ] }
// Wait for an email
const email = await client.waitForEmail({
email: mailbox.email,
password: mailbox.password,
regex: [
'This text is in the email',
// also supports regex in the form of a string
'/This text is in the email/^i'
]
});
console.log(email); // { success: true, response: { ... } }
}