giuguighgi

async function generateTempEmail() { const domain = “1secmail.com”; const name = Math.random().toString(36).substring(2, 10); const email = `${name}@${domain}`; document.getElementById(“emailDisplay”).innerText = email; document.getElementById(“emailList”).innerHTML = “

Fetching emails…

“; fetchInbox(name, domain); } async function fetchInbox(name, domain) { const emailList = document.getElementById(“emailList”); emailList.innerHTML = “

Loading emails…

“; const response = await fetch(`https://www.1secmail.com/api/v1/?action=getMessages&login=${name}&domain=${domain}`); const emails = await response.json(); if (emails.length === 0) { emailList.innerHTML = “

No new emails.

“; } else { emailList.innerHTML = “”; emails.forEach(async (email) => { const mailItem = document.createElement(“a”); mailItem.innerText = `${email.from} – ${email.subject}`; mailItem.href = “#”; mailItem.style.display = “block”; mailItem.style.padding = “10px”; mailItem.style.background = “#333”; mailItem.style.marginTop = “6px”; mailItem.style.textDecoration = “none”; mailItem.style.color = “#e0c3fc”; mailItem.style.borderRadius = “5px”; mailItem.style.textAlign = “center”; mailItem.onclick = async (event) => { event.preventDefault(); const mailResponse = await fetch(`https://www.1secmail.com/api/v1/?action=readMessage&login=${name}&domain=${domain}&id=${email.id}`); const mailContent = await mailResponse.json(); let inboxWindow = window.open(”, ‘_blank’); inboxWindow.document.write(` ${email.subject}

${email.subject}

From: ${mailContent.from}

${mailContent.textBody}

`); }; emailList.appendChild(mailItem); }); } } document.addEventListener(“DOMContentLoaded”, () => { document.getElementById(“generateBtn”).addEventListener(“click”, generateTempEmail); });
Scroll to Top