Hướng dẫn chi tiết cách sử dụng API Mail Reader để tích hợp vào ứng dụng của bạn
Mail Reader API cung cấp các endpoint để kiểm tra domain, lấy danh sách email và quản lý hòm thư tạm thời. Tất cả các API đều miễn phí và không yêu cầu authentication.
https://thanhori.click/docthumaildomain/
Kiểm tra xem domain có hỗ trợ nhận email hay không. API sẽ check MX record của domain.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| action | string | Có | Phải là "check_domain" |
| domain | string | Có | Tên domain cần kiểm tra (vd: example.com) |
fetch('https://thanhori.click/docthumaildomain/?action=check_domain&domain=thanhori.click')
.then(response => response.json())
.then(data => console.log(data));
{
"result": "online",
"message": "Domain có thể nhận email"
}
{
"result": "offline",
"message": "Domain không hỗ trợ nhận email"
}
{
"result": "error",
"message": "Domain không hợp lệ"
}
Lấy danh sách tất cả các domain có sẵn từ hệ thống và lưu vào file domain.json.
API này nên được gọi tối đa 1 lần/giờ để tránh tải server. Sử dụng API get_cached_domains để lấy dữ liệu đã cache.
fetch('https://thanhori.click/docthumaildomain/?action=fetch_domains')
.then(response => response.json())
.then(data => console.log(data));
{
"success": true,
"count": 150,
"domains": [
"domain1.com",
"domain2.net",
"domain3.org",
...
]
}
Lấy danh sách domains từ file cache (domain.json) mà không cần gọi API external.
Sử dụng API này thay vì fetch_domains để giảm tải server. Dữ liệu được cập nhật tự động mỗi 1 giờ.
curl https://thanhori.click/docthumaildomain/?action=get_cached_domains
{
"success": true,
"domains": [
"thanhori.click",
"example.com",
"test.net",
...
]
}
Lấy danh sách email trong hòm thư của một địa chỉ email cụ thể. Hỗ trợ phân trang.
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| action | string | Có | Phải là "get_emails" |
| string | Có | Địa chỉ email cần lấy thư (vd: test@thanhori.click) | |
| page | integer | Không | Số trang (mặc định: 1) |
| limit | integer | Không | Số email mỗi trang (mặc định: 20, tối đa: 100) |
import requests
url = "https://thanhori.click/docthumaildomain/"
params = {
"action": "get_emails",
"email": "test@thanhori.click",
"page": 1,
"limit": 20
}
response = requests.get(url, params=params)
data = response.json()
print(data)
{
"email": "test@thanhori.click",
"page": 1,
"limit": 20,
"total": 45,
"hasmore": true,
"emails": [
{
"id": "abc123",
"sender": "noreply@example.com",
"subject": "Xác nhận đăng ký",
"date": "2026-02-02T14:30:00Z",
"body": "Nội dung email...",
"html_body": "...",
"has_attachments": false
},
...
]
}
{
"error": true,
"message": "Email không hợp lệ"
}
Bạn có thể truy cập trực tiếp hòm thư của một email bằng cách thêm email vào URL:
https://thanhori.click/docthumaildomain/{email}
Để xem hòm thư của test@thanhori.click, truy cập:
https://thanhori.click/docthumaildomain/test@thanhori.click
| HTTP Code | Mô tả |
|---|---|
| 200 | Request thành công |
| 400 | Request không hợp lệ (thiếu tham số hoặc sai định dạng) |
| 404 | Không tìm thấy dữ liệu |
| 500 | Lỗi server |
| 503 | Service không khả dụng |
async function checkDomain(domain) {
const response = await fetch(
`https://thanhori.click/docthumaildomain/?action=check_domain&domain=${domain}`
);
const data = await response.json();
return data.result === 'online';
}
async function getEmails(email, page = 1, limit = 20) {
const url = `https://thanhori.click/docthumaildomain/?action=get_emails&email=${email}&page=${page}&limit=${limit}`;
const response = await fetch(url);
const data = await response.json();
if (data.error) {
throw new Error(data.message);
}
return data;
}
// Sử dụng
checkDomain('thanhori.click').then(isOnline => {
console.log('Domain online:', isOnline);
});
getEmails('test@thanhori.click').then(data => {
console.log('Emails:', data.emails);
});
function getEmails($email, $page = 1, $limit = 20) {
$url = "https://thanhori.click/docthumaildomain/";
$params = http_build_query([
'action' => 'get_emails',
'email' => $email,
'page' => $page,
'limit' => $limit
]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url . '?' . $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
// Sử dụng
$data = getEmails('test@thanhori.click', 1, 20);
print_r($data);
const axios = require('axios');
async function getEmails(email, page = 1, limit = 20) {
try {
const response = await axios.get('https://thanhori.click/docthumaildomain/', {
params: {
action: 'get_emails',
email: email,
page: page,
limit: limit
}
});
return response.data;
} catch (error) {
console.error('Error:', error.message);
throw error;
}
}
// Sử dụng
getEmails('test@thanhori.click')
.then(data => console.log(data))
.catch(error => console.error(error));
Hiện tại API không có giới hạn cứng, nhưng vui lòng:
Nếu bạn gặp vấn đề hoặc cần hỗ trợ, vui lòng liên hệ qua: