Blog

  • Hello world!

    Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>SPF Rescue Kit</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      padding: 20px;
      background: #f4f7fc;
      color: #333;
      max-width: 800px;
      margin: auto;
    }

    h1 {
      color: #1e73be;
    }

    .tool-container {
      background: white;
      padding: 20px;
      border-radius: 10px;
      box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    input, select, button {
      padding: 10px;
      font-size: 16px;
      margin: 10px 0;
      width: 100%;
      box-sizing: border-box;
    }

    pre {
      background: #eef;
      padding: 10px;
      border-radius: 5px;
      white-space: pre-wrap;
      word-wrap: break-word;
    }

    .warning {
      color: orange;
      font-weight: bold;
    }

    .upsell {
      border: 1px solid #ccc;
      background: #fdf6e3;
      padding: 15px;
      margin-top: 20px;
      border-radius: 5px;
    }

    .upsell button {
      background: #1e73be;
      color: white;
      border: none;
      padding: 10px 15px;
      font-size: 16px;
      cursor: pointer;
      margin-top: 10px;
    }

    .upsell button:hover {
      background: #155a94;
    }
  </style>
</head>
<body>
  <div class="tool-container">
    <h1>SPF Rescue Kit</h1>
    <label for="domain">Enter your domain:</label>
    <input type="text" id="domain" placeholder="example.com" />

    <label for="recordType">Choose a record type to check:</label>
    <select id="recordType">
      <option value="SPF">SPF</option>
      <option value="DKIM">DKIM</option>
      <option value="DMARC">DMARC</option>
    </select>

    <div id="selectorField" style="display:none;">
      <label for="selector">DKIM Selector:</label>
      <input type="text" id="selector" placeholder="e.g. selector1, s1, m365">
    </div>

    <button onclick="checkDNS()">Check Record</button>
    <div id="result"></div>
  </div>

  <script>
    const recordSelect = document.getElementById('recordType');
    const selectorField = document.getElementById('selectorField');

    recordSelect.addEventListener('change', () => {
      selectorField.style.display = recordSelect.value === 'DKIM' ? 'block' : 'none';
    });

    async function checkDNS() {
      const domain = document.getElementById('domain').value.trim();
      const type = document.getElementById('recordType').value;
      const selector = document.getElementById('selector')?.value.trim() || "default";
      const resultDiv = document.getElementById('result');
      resultDiv.innerHTML = "";

      if (!domain) {
        resultDiv.innerHTML = "<p style='color:red;'>Please enter a domain.</p>";
        return;
      }

      let queryName = domain;
      if (type === "DMARC") queryName = "_dmarc." + domain;
      if (type === "DKIM") queryName = selector + "._domainkey." + domain;

      try {
        const res = await fetch(`https://dns.google/resolve?name=${queryName}&type=TXT`);
        const data = await res.json();
        const records = data.Answer?.map(a => a.data.replace(/"/g, '')).join("<br>") || "No record found.";

        resultDiv.innerHTML = `
          <p><strong>${type} Record for ${domain}:</strong></p>
          <pre>${records}</pre>
          <div class="upsell">
            <p><strong>Need Help Fixing Your ${type} Record?</strong></p>
            <p>Our Pro service can flatten SPF, set up DMARC and DKIM properly, and help ensure your emails land in inboxes.</p>
            <a href="https://yourgumroadlink.com" target="_blank"><button>Fix It for Me – $29</button></a>
          </div>`;
      } catch (e) {
        resultDiv.innerHTML = "<p style='color:red;'>Failed to retrieve DNS records.</p>";
      }
    }
  </script>
</body>
</html>