{"id":2,"date":"2025-10-31T07:32:04","date_gmt":"2025-10-31T07:32:04","guid":{"rendered":"https:\/\/temp-mail.hongmanh.net\/?page_id=2"},"modified":"2025-10-31T07:55:46","modified_gmt":"2025-10-31T07:55:46","slug":"demo","status":"publish","type":"page","link":"https:\/\/temp-mail.hongmanh.net\/?page_id=2","title":{"rendered":"Demo"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">C\u00f4ng ty ch\u00fang t\u00f4i \u0111\u01b0\u1ee3c th\u00e0nh l\u1eadp n\u0103m 2010, v\u00e0 cung c\u1ea5p d\u1ecbch v\u1ee5 ch\u1ea5t l\u01b0\u1ee3ng cho r\u1ea5t nhi\u1ec1u s\u1ef1 ki\u1ec7n t\u1ea1i kh\u1eafp Vi\u1ec7t Nam. V\u1edbi v\u0103n ph\u00f2ng \u0111\u1eb7t t\u1ea1i H\u00e0 N\u1ed9i, TP. H\u1ed3 Ch\u00ed Minh c\u00f9ng h\u01a1n 40 nh\u00e2n s\u1ef1, ch\u00fang t\u00f4i l\u00e0 n\u01a1i nhi\u1ec1u \u0111\u1ed1i t\u00e1c tin t\u01b0\u1edfng giao cho t\u1ed5 ch\u1ee9c c\u00e1c s\u1ef1 ki\u1ec7n l\u1edbn.<\/p>\n\n\n<div class=\"tmm-form\">\r\n  <h3>\ud83d\udcec T\u1ea1o Email T\u1ea1m<\/h3>\r\n  <form id=\"tmm-form\">\r\n    <input type=\"text\" name=\"username\" placeholder=\"Nh\u1eadp t\u00ean email...\" required>\r\n    <select name=\"domain\">\r\n              <option value=\"thuysancualo.com\">thuysancualo.com<\/option>\r\n          <\/select>\r\n    <input type=\"hidden\" name=\"tmm_nonce\" value=\"1c2911fb77\">\r\n    <input type=\"hidden\" name=\"g_recaptcha_token\" id=\"g_recaptcha_token\" value=\"\">\r\n    <button type=\"submit\" id=\"tmm-submit\">T\u1ea1o Email<\/button>\r\n  <\/form>\r\n\r\n  <div id=\"tmm-result\" style=\"margin-top:12px;\"><\/div>\r\n\r\n  <div id=\"tmm-new-session\" style=\"margin-top:10px;display:none;\">\r\n    <button class=\"button\" id=\"tmm-new-btn\">\ud83c\udd95 T\u1ea1o email m\u1edbi<\/button>\r\n  <\/div>\r\n\r\n  <div id=\"tmm-inbox\" style=\"margin-top:20px;display:none;\">\r\n    <div style=\"display:flex;justify-content:space-between;align-items:center;\">\r\n      <h3>\ud83d\udce9 H\u1ed9p th\u01b0 \u0111\u1ebfn<\/h3>\r\n      <div>\r\n        <span id=\"tmm-countdown\" style=\"margin-right:12px;font-weight:600;color:#333;\"><\/span>\r\n        <button id=\"tmm-copy\" class=\"button\" title=\"Sao ch\u00e9p email\">\ud83d\udccb Copy<\/button>\r\n        <button id=\"tmm-refresh\" class=\"button\">\ud83d\udd01 L\u00e0m m\u1edbi th\u01b0<\/button>\r\n      <\/div>\r\n    <\/div>\r\n    <div id=\"tmm-mail-list\" style=\"border:1px solid #ccc;padding:10px;border-radius:8px;\">\r\n      <p>H\u1ed9p th\u01b0 c\u1ee7a b\u1ea1n \u0111ang tr\u1ed1ng<br>\u0110ang ch\u1edd email \u0111\u1ebfn...<\/p>\r\n    <\/div>\r\n  <\/div>\r\n<\/div>\r\n\r\n<!-- Hi\u1ec7u \u1ee9ng \u00e2m thanh -->\r\n<audio id=\"tmm-sound\" preload=\"auto\">\r\n  <source src=\"https:\/\/actions.google.com\/sounds\/v1\/alarms\/beep_short.ogg\" type=\"audio\/ogg\">\r\n<\/audio>\r\n\r\n<!-- Popup xem chi ti\u1ebft -->\r\n<div id=\"tmm-modal\" style=\"display:none;position:fixed;top:0;left:0;width:100%;height:100%;\r\nbackground:rgba(0,0,0,0.6);z-index:9999;align-items:center;justify-content:center;\">\r\n  <div style=\"background:#fff;padding:20px;max-width:800px;width:90%;border-radius:10px;position:relative;\">\r\n    <button id=\"tmm-close\" style=\"position:absolute;top:10px;right:10px;\">\u2716<\/button>\r\n    <div id=\"tmm-mail-content\">\u0110ang t\u1ea3i...<\/div>\r\n  <\/div>\r\n<\/div>\r\n\r\n<script src=\"https:\/\/www.google.com\/recaptcha\/api.js?render=6Le_F_0rAAAAAB1rCOgs-i4Evgk5jJ8v-D1rsNO9\"><\/script>\r\n<script>\r\nasync function getRecaptchaToken() {\r\n  try {\r\n    const token = await grecaptcha.execute('6Le_F_0rAAAAAB1rCOgs-i4Evgk5jJ8v-D1rsNO9', {action: 'tmm_create'});\r\n    return token;\r\n  } catch (e) {\r\n    console.warn(\"\u26a0\ufe0f Kh\u00f4ng th\u1ec3 l\u1ea5y token reCAPTCHA:\", e);\r\n    document.getElementById('tmm-result').innerHTML =\r\n      '<p style=\"color:#d77\">\u26a0\ufe0f reCAPTCHA \u0111ang b\u1ecb ch\u1eb7n \u2014 \u0111ang chuy\u1ec3n sang ch\u1ebf \u0111\u1ed9 an to\u00e0n.<\/p>';\r\n    return ''; \/\/ fallback\r\n  }\r\n}\r\n<\/script>\r\n\r\n<script>\r\n\/* ====== Client-side session + countdown + inbox handling (v4.4) ====== *\/\r\n\r\nlet currentMailbox = '';\r\nlet currentPassword = '';\r\nlet currentExpireISO = ''; \/\/ ISO string UTC\r\nlet previousMailIds = [];\r\nlet isFirstLoad = true;\r\nlet inboxInterval = null;\r\n\r\n\/* format seconds -> D HH:MM:SS or HH:MM:SS *\/\r\nfunction formatRemaining(seconds) {\r\n  if (seconds <= 0) return '00:00:00';\r\n  const days = Math.floor(seconds \/ 86400);\r\n  seconds %= 86400;\r\n  const hh = String(Math.floor(seconds \/ 3600)).padStart(2, '0');\r\n  seconds %= 3600;\r\n  const mm = String(Math.floor(seconds \/ 60)).padStart(2, '0');\r\n  const ss = String(seconds % 60).padStart(2, '0');\r\n  return (days ? (days + 'd ') : '') + hh + ':' + mm + ':' + ss;\r\n}\r\n\r\n\/* Update countdown UI and handle expiration *\/\r\nfunction updateCountdown() {\r\n  if (!currentExpireISO) return;\r\n  const end = new Date(currentExpireISO).getTime();\r\n  const now = Date.now();\r\n  const diff = Math.floor((end - now) \/ 1000);\r\n  const el = document.getElementById('tmm-countdown');\r\n  if (!el) return;\r\n  if (diff <= 0) {\r\n    el.textContent = '\u0110\u00e3 h\u1ebft h\u1ea1n';\r\n    \/\/ auto clear session and hide inbox\r\n    sessionStorage.removeItem('tmm_user');\r\n    document.getElementById('tmm-inbox').style.display = 'none';\r\n    document.getElementById('tmm-result').innerHTML = '<p style=\"color:#d77\">H\u1ed9p th\u01b0 \u0111\u00e3 h\u1ebft h\u1ea1n v\u00e0 \u0111\u01b0\u1ee3c x\u00f3a kh\u1ecfi phi\u00ean n\u00e0y.<\/p>';\r\n    if (inboxInterval) { clearInterval(inboxInterval); inboxInterval = null; }\r\n    return;\r\n  } else {\r\n    el.textContent = 'H\u1ed9p th\u01b0 s\u1ebd h\u1ebft h\u1ea1n sau: ' + formatRemaining(diff);\r\n  }\r\n}\r\n\r\n\/* load inbox (AJAX) *\/\r\nasync function loadInbox(manual=false) {\r\n  if (!currentMailbox) return;\r\n  const listBox = document.getElementById('tmm-mail-list');\r\n  if (manual) listBox.innerHTML = '<p>\ud83d\udd04 \u0110ang t\u1ea3i th\u01b0...<\/p>';\r\n  try {\r\n    const res = await fetch('https:\/\/temp-mail.hongmanh.net\/wp-admin\/admin-ajax.php?action=tmm_get_inbox&mailbox=' + encodeURIComponent(currentMailbox));\r\n    const mails = await res.json();\r\n\r\n    if (!mails || !mails.length) {\r\n      listBox.innerHTML = '<p>H\u1ed9p th\u01b0 c\u1ee7a b\u1ea1n \u0111ang tr\u1ed1ng<br>\u0110ang ch\u1edd email \u0111\u1ebfn...<\/p>';\r\n      previousMailIds = [];\r\n      return;\r\n    }\r\n\r\n    const currentIds = mails.map(m => m.id);\r\n    const newMail = previousMailIds.length > 0 && currentIds.some(id => !previousMailIds.includes(id));\r\n    if (newMail && !isFirstLoad) {\r\n      const audio = document.getElementById('tmm-sound');\r\n      audio.currentTime = 0;\r\n      audio.play().catch(()=>{});\r\n      document.getElementById('tmm-inbox').style.boxShadow = '0 0 10px 3px rgba(0,255,0,0.25)';\r\n      setTimeout(()=>document.getElementById('tmm-inbox').style.boxShadow='none',1400);\r\n    }\r\n\r\n    previousMailIds = currentIds;\r\n    isFirstLoad = false;\r\n\r\n    let html = '<table style=\"width:100%;border-collapse:collapse;\">';\r\n    html += '<tr><th style=\"text-align:left;\">Ng\u01b0\u1eddi g\u1eedi<\/th><th>Ti\u00eau \u0111\u1ec1<\/th><th>Ng\u00e0y<\/th><\/tr>';\r\n    mails.forEach(m => {\r\n      html += `<tr>\r\n        <td>${m.from}<\/td>\r\n        <td><a href=\"javascript:viewMessage('${m.id}')\">${m.subject}<\/a>${m.has_attach ? ' \ud83d\udcce' : ''}<\/td>\r\n        <td>${m.date}<\/td>\r\n      <\/tr>`;\r\n    });\r\n    html += '<\/table>';\r\n    listBox.innerHTML = html;\r\n  } catch (err) {\r\n    listBox.innerHTML = '<p style=\"color:red\">L\u1ed7i t\u1ea3i th\u01b0.<\/p>';\r\n    console.error(err);\r\n  }\r\n}\r\n\r\n\/* View message detail (AJAX) *\/\r\nasync function viewMessage(id) {\r\n  const modal = document.getElementById('tmm-modal');\r\n  const content = document.getElementById('tmm-mail-content');\r\n  modal.style.display = 'flex';\r\n  content.innerHTML = '\u23f3 \u0110ang t\u1ea3i n\u1ed9i dung...';\r\n\r\n  try {\r\n    const res = await fetch('https:\/\/temp-mail.hongmanh.net\/wp-admin\/admin-ajax.php?action=tmm_get_message&id=' + id);\r\n    const data = await res.json();\r\n    if (!data.success) {\r\n      content.innerHTML = '<p style=\"color:red;\">Kh\u00f4ng th\u1ec3 t\u1ea3i n\u1ed9i dung email.<\/p>';\r\n      return;\r\n    }\r\n    const msg = data.data[0] || {};\r\n    const subject = msg.subject || '(Kh\u00f4ng c\u00f3 ti\u00eau \u0111\u1ec1)';\r\n    const from = msg.from || '(Kh\u00f4ng r\u00f5 ng\u01b0\u1eddi g\u1eedi)';\r\n    const htmlBody = msg.html || msg.text_plain || '(Kh\u00f4ng c\u00f3 n\u1ed9i dung)';\r\n\r\n    let attachmentsHTML = '';\r\n    if (msg.attachments && msg.attachments.length) {\r\n      attachmentsHTML = '<h4>\ud83d\udcce \u0110\u00ednh k\u00e8m:<\/h4><ul>';\r\n      msg.attachments.forEach(a => {\r\n        \/\/ \u0111\u01b0\u1eddng d\u1eabn t\u1ea3i t\u1eeb Mailcow API\r\n        const partUrl = 'https:\/\/nhcontrolmc.email-nhanhoa.net\/api\/v1\/get\/message\/part\/' + a.id;\r\n        attachmentsHTML += `<li><a href=\"${partUrl}\" target=\"_blank\" rel=\"noopener noreferrer\">${a.filename}<\/a><\/li>`;\r\n      });\r\n      attachmentsHTML += '<\/ul>';\r\n    }\r\n\r\n    content.innerHTML = `\r\n      <h3>${subject}<\/h3>\r\n      <p><b>T\u1eeb:<\/b> ${from}<\/p>\r\n      <hr>\r\n      <div style=\"max-height:400px;overflow:auto;\">${htmlBody}<\/div>\r\n      ${attachmentsHTML}\r\n    `;\r\n  } catch (err) {\r\n    content.innerHTML = '<p style=\"color:red\">L\u1ed7i khi t\u1ea3i n\u1ed9i dung.<\/p>';\r\n    console.error(err);\r\n  }\r\n}\r\n\r\n\/* Close modal *\/\r\ndocument.getElementById('tmm-close').addEventListener('click', ()=>{\r\n  document.getElementById('tmm-modal').style.display='none';\r\n});\r\n\r\n\/* Handle form submit *\/\r\ndocument.getElementById('tmm-form').addEventListener('submit', async (e) => {\r\n  e.preventDefault();\r\n  \/\/ get recaptcha token if exists\r\n  if (typeof grecaptcha !== 'undefined') {\r\n    const token = await getRecaptchaToken();\r\n    document.getElementById('g_recaptcha_token').value = token;\r\n  } else {\r\n    document.getElementById('g_recaptcha_token').value = '';\r\n  }\r\n  \/\/ send form\r\n  const form = document.getElementById('tmm-form');\r\n  const formData = new FormData(form);\r\n  const box = document.getElementById('tmm-result');\r\n  box.innerHTML = '<p>\u23f3 \u0110ang x\u1eed l\u00fd...<\/p>';\r\n  try {\r\n    const res = await fetch('https:\/\/temp-mail.hongmanh.net\/wp-admin\/admin-ajax.php?action=tmm_create', { method:'POST', body:formData });\r\n    const data = await res.json();\r\n    if (data.success) {\r\n      currentMailbox = data.mailbox;\r\n      currentPassword = data.password;\r\n      currentExpireISO = data.expire_at; \/\/ ISO UTC\r\n      \/\/ l\u01b0u session (m\u1ea5t khi \u0111\u00f3ng tr\u00ecnh duy\u1ec7t)\r\n      sessionStorage.setItem('tmm_user', JSON.stringify({\r\n        mailbox: currentMailbox,\r\n        password: currentPassword,\r\n        expire_at: currentExpireISO\r\n      }));\r\n      document.getElementById('tmm-result').innerHTML = `<p>Email: <b>${currentMailbox}<\/b><br>M\u1eadt kh\u1ea9u: <b>${currentPassword}<\/b><\/p>`;\r\n      document.getElementById('tmm-new-session').style.display = 'block';\r\n      document.getElementById('tmm-inbox').style.display = 'block';\r\n      \/\/ start countdown + load inbox\r\n      updateCountdown();\r\n      if (inboxInterval) clearInterval(inboxInterval);\r\n      inboxInterval = setInterval(()=>{ updateCountdown(); loadInbox(); }, 15000);\r\n      loadInbox(true);\r\n    } else {\r\n      document.getElementById('tmm-result').innerHTML = `<p style=\"color:red\">${data.error}<\/p>`;\r\n    }\r\n  } catch (err) {\r\n    document.getElementById('tmm-result').innerHTML = `<p style=\"color:red\">L\u1ed7i k\u1ebft n\u1ed1i m\u00e1y ch\u1ee7.<\/p>`;\r\n    console.error(err);\r\n  }\r\n});\r\n\r\n\/* On DOM ready, restore session if any *\/\r\ndocument.addEventListener('DOMContentLoaded', () => {\r\n  const saved = sessionStorage.getItem('tmm_user');\r\n  if (saved) {\r\n    try {\r\n      const data = JSON.parse(saved);\r\n      currentMailbox = data.mailbox;\r\n      currentPassword = data.password;\r\n      currentExpireISO = data.expire_at;\r\n      document.getElementById('tmm-result').innerHTML = `<p>Email: <b>${currentMailbox}<\/b><br>M\u1eadt kh\u1ea9u: <b>${currentPassword}<\/b><\/p>`;\r\n      document.getElementById('tmm-new-session').style.display = 'block';\r\n      document.getElementById('tmm-inbox').style.display = 'block';\r\n      \/\/ start countdown and inbox refresh\r\n      updateCountdown();\r\n      if (inboxInterval) clearInterval(inboxInterval);\r\n      inboxInterval = setInterval(()=>{ updateCountdown(); loadInbox(); }, 15000);\r\n      loadInbox(true);\r\n      isFirstLoad = true; \/\/ first load shouldn't trigger sound\r\n    } catch(e){ console.error('Invalid session data', e); }\r\n  }\r\n});\r\n\r\n\/* New session (create new mailbox) *\/\r\ndocument.getElementById('tmm-new-btn').addEventListener('click', ()=>{\r\n  sessionStorage.removeItem('tmm_user');\r\n  location.reload();\r\n});\r\n\r\n\/* Refresh button *\/\r\ndocument.getElementById('tmm-refresh').addEventListener('click', ()=>{ loadInbox(true); });\r\n\r\n\/* Copy mailbox *\/\r\ndocument.getElementById('tmm-copy').addEventListener('click', ()=>{\r\n  if (!currentMailbox) return;\r\n  navigator.clipboard.writeText(currentMailbox).then(()=>{\r\n    const btn = document.getElementById('tmm-copy');\r\n    btn.textContent = '\u2705 \u0110\u00e3 sao ch\u00e9p';\r\n    setTimeout(()=> btn.textContent = '\ud83d\udccb Copy', 1500);\r\n  }).catch(()=> alert('Kh\u00f4ng th\u1ec3 sao ch\u00e9p. H\u00e3y th\u1eed th\u1ee7 c\u00f4ng.'));\r\n});\r\n<\/script>\r\n\n\n\n\n<p class=\"wp-block-paragraph\">L\u00e0 m\u1ed9t ng\u01b0\u1eddi d\u00f9ng WordPress m\u1edbi, b\u1ea1n n\u00ean gh\u00e9 th\u0103m <a href=\"https:\/\/temp-mail.hongmanh.net\/wp-admin\/\">b\u1ea3ng tin<\/a> \u0111\u1ec3 x\u00f3a trang n\u00e0y v\u00e0 t\u1ea1o trang m\u1edbi cho n\u1ed9i dung c\u1ee7a ch\u00ednh b\u1ea1n. Ch\u00fac b\u1ea1n vui v\u1ebb!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C\u00f4ng ty ch\u00fang t\u00f4i \u0111\u01b0\u1ee3c th\u00e0nh l\u1eadp n\u0103m 2010, v\u00e0 cung c\u1ea5p d\u1ecbch v\u1ee5 ch\u1ea5t l\u01b0\u1ee3ng cho r\u1ea5t nhi\u1ec1u s\u1ef1 ki\u1ec7n t\u1ea1i kh\u1eafp Vi\u1ec7t Nam. V\u1edbi v\u0103n ph\u00f2ng \u0111\u1eb7t t\u1ea1i H\u00e0 N\u1ed9i, TP. H\u1ed3 Ch\u00ed Minh c\u00f9ng h\u01a1n 40 nh\u00e2n s\u1ef1, ch\u00fang t\u00f4i l\u00e0 n\u01a1i nhi\u1ec1u \u0111\u1ed1i t\u00e1c tin t\u01b0\u1edfng giao cho t\u1ed5 ch\u1ee9c c\u00e1c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=\/wp\/v2\/pages\/2","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2"}],"version-history":[{"count":2,"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=\/wp\/v2\/pages\/2\/revisions"}],"predecessor-version":[{"id":9,"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=\/wp\/v2\/pages\/2\/revisions\/9"}],"wp:attachment":[{"href":"https:\/\/temp-mail.hongmanh.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}