Screenshot-2024-11-29T09 26 18

Open disposable-email in Script Kit

// Name: Disposable email
// Description: Generate a disposable email address, open the inbox in the browser, and copy the email address to the clipboard
// Acknowledgments:
// - https://www.alfredforum.com/topic/4643-temporary-email-%E2%80%94-generate-disposable-email-inboxes/
import "@johnlindquist/kit"
import { uniqueNamesGenerator, adjectives, animals, colors } from 'unique-names-generator';
// The ones with auto: true will copy the email address to clipboard, the ones with auto: false will not
const providers = {
"maildrop.cc": { name: "Maildrop", auto: true },
"harakirimail.com": { name: "Harakirimail", auto: true },
"incognitomail.co": { name: "Incognitomail", auto: false },
"temporarymail.com": { name: "Temporarymail", auto: false },
"mail.tm": { name: "Mail.tm", auto: false },
"dropmail.me": { name: "Dropmail", auto: false },
"guerrillamail.com": { name: "Guerrillamail", auto: false }
};
let provider = await arg({
placeholder: `Select Provider`,
choices: Object.entries(providers).map(([name, def]) => ({
name: def.name,
description: def.auto ? `🤖 Auto-copies email to clipboard` : `🫵 Manually copy email from website`,
value: name
}))
});
let def = providers[provider];
if (!def) throw new Error(`Invalid provider: ${provider}`);
if (def.auto) {
const desiredEmailName = uniqueNamesGenerator({
dictionaries: [adjectives, animals],
length: 2,
separator: '-',
});
const email = `${desiredEmailName}@${provider}`;
let url: string;
if (provider === 'maildrop.cc') {
url = `https://${provider}/inbox/?mailbox=${desiredEmailName}`;
} else {
url = `https://${provider}/inbox/${desiredEmailName}`;
}
await clipboard.writeText(email);
await open(url);
await notify(`Email: ${email} copied to clipboard`);
} else {
await open(`https://${provider}`);
await notify(`Get the email address from the website`);
}