/** * Tmail Cloud Temporary Email Scraper & Generator * Author: Vamz Spectre (VamxAPI) * Target: https://tmailcloud.my.id * Description: * API client for Tmail Cloud (temp mail without expiration). * Generate custom/random email addresses and fetch incoming messages. * * Usage CLI: * curl -sL "https://code.vamxapi.my.id/snippet/raw/tmailcloud" -o tmailcloud.js * node tmailcloud.js domains * node tmailcloud.js generate [username] [domain] * node tmailcloud.js inbox test@tmailcloud.my.id */ const HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' }; const BASE = 'https://tmailcloud.my.id/api'; async function getDomains() { const res = await fetch(`${BASE}/domains`, { headers: HEADERS }); if (!res.ok) throw new Error(`TmailCloud domains failed: ${res.status}`); const data = await res.json(); return { status: true, author: 'Vamz Spectre', provider: 'tmailcloud.my.id', domains: (data.domains || []).map(d => ({ id: d.id, domain: d.name, isActive: d.is_active, isDefault: d.is_default })) }; } async function generateEmail(username = null, domain = 'tmailcloud.my.id') { const payload = { domain }; if (username) payload.username = username; const res = await fetch(`${BASE}/email/generate`, { method: 'POST', headers: { ...HEADERS, 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); if (!res.ok) throw new Error(`TmailCloud generate failed: ${res.status}`); const data = await res.json(); return { status: true, author: 'Vamz Spectre', provider: 'tmailcloud.my.id', email: data.email, inbox: data.inbox }; } async function getInbox(address) { if (!address) throw new Error('Email address is required'); const res = await fetch(`${BASE}/email/inbox/${encodeURIComponent(address)}`, { headers: HEADERS }); if (!res.ok) throw new Error(`TmailCloud inbox failed: ${res.status}`); const data = await res.json(); return { status: true, author: 'Vamz Spectre', provider: 'tmailcloud.my.id', address: data.address, total: data.total || 0, messages: data.messages || [] }; } // CLI Runner if (require.main === module) { const action = (process.argv[2] || 'inbox').toLowerCase(); const arg1 = process.argv[3]; const arg2 = process.argv[4]; (async () => { try { let result; if (action === 'domains') { result = await getDomains(); } else if (action === 'generate') { result = await generateEmail(arg1, arg2); } else { result = await getInbox(arg1 || 'test@tmailcloud.my.id'); } console.log(JSON.stringify(result, null, 2)); } catch (err) { console.error(JSON.stringify({ status: false, error: err.message }, null, 2)); process.exit(1); } })(); } module.exports = { getDomains, generateEmail, getInbox };