1233 条记录
52 私有链接
52 私有链接
该内容介绍了一个电子邮件验证工具,主要功能是检查电子邮件地址的有效性和是否已被注册。工具通过颜色标记结果:红色表示已注册,绿色表示大概率未注册(但有小概率已被注册但不可用)。工具使用Site24x7的API进行验证,并提供了一个简单的网页界面供用户输入和查看结果。
// src/index.js
var src_default = {
async fetch(request, env, ctx) {
if (request.method === "GET") {
return new Response(html, {
headers: {
"content-type": "text/html;charset=UTF-8"
}
});
} else if (request.method === "POST") {
const formData = await request.formData();
const emails = formData.get("emails").split("\n");
const results = [];
for (const email of emails) {
try {
const response = await fetch("https://www.site24x7.com/tools/email-validator", {
headers: {
accept: "*/*",
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8",
"content-type": "application/x-www-form-urlencoded",
"sec-ch-ua": '"Chromium";v="122", "Google Chrome";v="122", "Not(A:Brand";v="24"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
Referer: "https://www.site24x7.com/tools/email-validator.html",
Origin: "https://www.site24x7.com"
},
body: `emails=${encodeURIComponent(email.trim())}`,
method: "POST"
});
const text = await response.text();
const isValid = text.includes("250");
const isInvalid = text.includes("550");
results.push({
email: email.trim(),
status: isValid ? "\u5DF2\u6CE8\u518C" : isInvalid ? "\u672A\u6CE8\u518C\u6216\u90AE\u7BB1\u65E0\u6548" : "\u65E0\u6548\u90AE\u7BB1",
detail: text,
timestamp: (/* @__PURE__ */ new Date()).toISOString()
});
} catch (error) {
console.error("Error:", error);
results.push({
email: email.trim(),
status: "\u68C0\u6D4B\u51FA\u9519",
detail: error.message,
timestamp: (/* @__PURE__ */ new Date()).toISOString()
});
}
}
return new Response(JSON.stringify(results), {
headers: {
"content-type": "application/json;charset=UTF-8"
}
});
}
}
};
var html = `<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>\u90AE\u7BB1\u6CE8\u518C\u68C0\u6D4B\u5DE5\u5177</title>
<script src="https://cdn.tailwindcss.com"><\/script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
:root {
--primary-color: #2D5A8B;
--secondary-color: #6B8EB3;
--accent-color: #91B6D8;
--background-start: #EEF2F6;
--background-end: #F5F7FA;
}
body {
font-family: 'Inter', system-ui, -apple-system, sans-serif;
background: linear-gradient(135deg, var(--background-start), var(--background-end));
min-height: 100vh;
}
.glassmorphism {
background: rgba(255, 255, 255, 0.7);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
border: 1px solid rgba(209, 213, 219, 0.3);
box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.05),
0 2px 4px -1px rgba(0, 0, 0, 0.03),
0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}
.hover-effect {
transition: all 0.3s ease;
}
.hover-effect:hover {
transform: translateY(-2px);
box-shadow:
0 8px 12px -1px rgba(0, 0, 0, 0.08),
0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.status-registered {
color: #dc2626;
background-color: rgba(220, 38, 38, 0.1);
}
.status-unregistered {
color: #059669;
background-color: rgba(5, 150, 105, 0.1);
}
.status-invalid {
color: #059669;
background-color: rgba(5, 150, 105, 0.1);
}
.info-card {
background: rgba(255, 255, 255, 0.8);
border-left: 4px solid var(--primary-color);
}
.info-modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
}
.info-modal.show {
display: flex;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.modal-content {
animation: slideIn 0.3s ease;
}
@keyframes slideIn {
from { transform: translateY(-20px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
</style>
</head>
<body class="p-6 space-y-6">
<div class="max-w-4xl mx-auto">
<div class="glassmorphism rounded-2xl p-8 hover-effect">
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-semibold text-gray-800">\u90AE\u7BB1\u6CE8\u518C\u68C0\u6D4B\u5DE5\u5177</h1>
<button id="infoBtn" class="glassmorphism p-2 rounded-full hover:shadow-lg transition-all">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</button>
</div>
<form id="emailForm" class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">
\u8BF7\u8F93\u5165\u90AE\u7BB1\u5730\u5740\uFF08\u6BCF\u884C\u4E00\u4E2A\uFF09\uFF1A
</label>
<textarea
name="emails"
required
class="w-full h-48 p-4 border border-gray-200 rounded-xl focus:ring-2 focus:ring-blue-400 focus:border-transparent outline-none resize-none glassmorphism"
placeholder="example@domain.com"
></textarea>
</div>
<button
type="submit"
class="w-full py-3 px-4 rounded-xl bg-gradient-to-r from-[var(--primary-color)] to-[var(--secondary-color)] text-white font-medium transition-all hover:opacity-90 hover:shadow-lg"
>
\u5F00\u59CB\u68C0\u6D4B
</button>
</form>
</div>
<div id="results" class="space-y-4 mt-6"></div>
</div>
<div id="infoModal" class="info-modal">
<div class="modal-content max-w-2xl w-full mx-auto my-auto p-6">
<div class="glassmorphism rounded-xl p-6 relative">
<button id="closeModal" class="absolute top-4 right-4 text-gray-500 hover:text-gray-700">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
<h2 class="text-lg font-semibold text-gray-800 mb-3">\u5173\u4E8E\u6B64\u5DE5\u5177</h2>
<div class="space-y-3 text-gray-600">
<p>\u6B64\u5DE5\u5177\u5C06\u9A8C\u8BC1\u7535\u5B50\u90AE\u4EF6\u5730\u5740\u7684\u6709\u6548\u6027\uFF0C\u5E76\u786E\u8BA4\u5176\u662F\u5426\u5B58\u5728\u3002\u8BE5\u5DE5\u5177\u5C06\u4E0E\u7535\u5B50\u90AE\u4EF6\u670D\u52A1\u5668\u8FDE\u63A5\uFF0C\u5E76\u786E\u8BA4\u60A8\u8F93\u5165\u7684\u7535\u5B50\u90AE\u4EF6 id \u7684\u6709\u6548\u6027\u3002</p>
<div class="flex items-center gap-4 my-4">
<div class="flex items-center">
<span class="inline-block w-3 h-3 rounded-full bg-red-500 mr-2"></span>
<span class="text-sm">\u7EA2\u8272\uFF1A\u5DF2\u786E\u8BA4\u6CE8\u518C</span>
</div>
<div class="flex items-center">
<span class="inline-block w-3 h-3 rounded-full bg-green-500 mr-2"></span>
<span class="text-sm">\u7EFF\u8272\uFF1A\u5927\u6982\u7387\u672A\u6CE8\u518C\uFF08\u5C0F\u6982\u7387\u88AB\u6CE8\u518C\u4F46\u4E0D\u53EF\u7528\uFF09</span>
</div>
</div>
<p class="text-sm">\u7535\u5B50\u90AE\u4EF6\u9A8C\u8BC1\u662F\u9A8C\u8BC1\u7535\u5B50\u90AE\u4EF6\u5730\u5740\u662F\u5426\u6709\u6548\u7684\u8FC7\u7A0B\u3002\u5982\u679C\u6709\u4EFB\u4F55\u6253\u5B57\u9519\u8BEF\u6216\u5176\u4ED6\u53EF\u80FD\u5BFC\u81F4\u9519\u8BEF\u6307\u793A\u548C\u8DF3\u8F6C\u7684\u9519\u8BEF\uFF0C\u672C\u7A0B\u5E8F\u5C06\u6355\u83B7\u3002\u7535\u5B50\u90AE\u4EF6\u9A8C\u8BC1\u8FD8\u5C06\u786E\u8BA4\u7535\u5B50\u90AE\u4EF6\u662F\u5426\u5B58\u5728\u6709\u6548\u57DF\uFF0C\u5982\u8C37\u6B4C\u6216\u96C5\u864E\u3002</p>
<p class="text-sm">\u9A8C\u8BC1\u7535\u5B50\u90AE\u4EF6\u5730\u5740\u7684\u4E3B\u8981\u76EE\u7684\uFF1A</p>
<ul class="list-disc list-inside text-sm ml-4 space-y-1">
<li>\u6D88\u9664\u786C\u53CD\u5F39</li>
<li>\u51CF\u5C11\u5783\u573E\u90AE\u4EF6\u6295\u8BC9</li>
<li>\u907F\u514D\u88AB\u5217\u5165\u9ED1\u540D\u5355</li>
</ul>
<div class="text-xs text-gray-400 mt-4">
\u6570\u636E\u6765\u6E90\uFF1A<a href="https://www.site24x7.com/tools/email-validator" target="_blank" class="text-blue-500 hover:underline">Site24x7 Email Validator</a>
</div>
</div>
</div>
</div>
</div>
<script>
document.getElementById('emailForm').addEventListener('submit', async (e) => {
e.preventDefault();
const form = e.target;
const resultsDiv = document.getElementById('results');
resultsDiv.innerHTML = '<div class="glassmorphism rounded-xl p-6 text-center text-gray-600">\u6B63\u5728\u68C0\u6D4B\u4E2D...</div>';
try {
const response = await fetch('/', {
method: 'POST',
body: new FormData(form)
});
const results = await response.json();
const getStatusClass = (status) => {
switch(status) {
case '\u5DF2\u6CE8\u518C': return 'status-registered';
case '\u672A\u6CE8\u518C\u6216\u90AE\u7BB1\u65E0\u6548': return 'status-unregistered';
case '\u65E0\u6548\u90AE\u7BB1': return 'status-invalid';
default: return 'text-gray-500';
}
};
const resultHTML = results.map(result => {
const statusClass = getStatusClass(result.status);
return '<div class="glassmorphism rounded-xl p-6 hover-effect">' +
'<div class="flex items-center justify-between">' +
'<span class="font-medium text-gray-800">' + result.email + '</span>' +
'<span class="' + statusClass + ' font-medium px-3 py-1 rounded-full">' + result.status + '</span>' +
'</div>' +
'<div class="mt-2 text-xs text-gray-400">' +
'\u68C0\u6D4B\u65F6\u95F4: ' + new Date(result.timestamp).toLocaleString() +
'</div>' +
'</div>';
}).join('');
resultsDiv.innerHTML = resultHTML;
} catch (error) {
resultsDiv.innerHTML = '<div class="glassmorphism rounded-xl p-6">' +
'<div class="text-red-500">\u68C0\u6D4B\u8FC7\u7A0B\u51FA\u9519\uFF1A' + error.message + '</div>' +
'</div>';
}
});
// \u6DFB\u52A0\u6A21\u6001\u6846\u63A7\u5236\u811A\u672C
const infoBtn = document.getElementById('infoBtn');
const infoModal = document.getElementById('infoModal');
const closeModal = document.getElementById('closeModal');
infoBtn.addEventListener('click', () => {
infoModal.classList.add('show');
});
closeModal.addEventListener('click', () => {
infoModal.classList.remove('show');
});
// \u70B9\u51FB\u6A21\u6001\u6846\u5916\u90E8\u5173\u95ED
infoModal.addEventListener('click', (e) => {
if (e.target === infoModal) {
infoModal.classList.remove('show');
}
});
// ESC\u952E\u5173\u95ED\u6A21\u6001\u6846
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && infoModal.classList.contains('show')) {
infoModal.classList.remove('show');
}
});
<\/script>
</body>
</html>`;
export {
src_default as default
};
//# sourceMappingURL=index.js.map