Developer

API đọc mail

REST · JSON · miễn phí, không cần API key. Giới hạn 60 request/phút mỗi IP.

Endpoint

POST/api/v1/read-mail

Đọc hàng loạt

Gửi mảng accounts, nhận results tương ứng theo thứ tự.

FieldTypeRequiredMô tả
mode"oauth" | "graph" | "roundcube"Tùy chọnPhương thức đọc. Mặc định "oauth". "imap" được coi như "oauth".
accountsstring[]Bắt buộcMỗi phần tử là một dòng tài khoản, định dạng email|pass|refresh_token|client_id (hoặc email|password với roundcube).
curl -X POST https://likemmo.tech/api/v1/read-mail \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "oauth",
    "accounts": [
      "a@outlook.com|pass|M.C5...|client-id",
      "b@hotmail.com|pass|M.C5...|client-id"
    ]
  }'

Phản hồi

{
  "success": true,
  "results": [
    {
      "email": "a@outlook.com",
      "status": "ok",
      "code": "847291",
      "messages": [ { "from": "...", "subject": "...", "extractedCode": { "code": "847291" } } ]
    },
    { "email": "b@hotmail.com", "status": "empty", "messages": [] }
  ]
}

Đọc một tài khoản

Giữ tương thích phiên bản cũ. Trả về { success, messages, error? }.

FieldTypeRequiredMô tả
emailstringBắt buộcĐịa chỉ email
refreshTokenstringBắt buộcOAuth2 refresh token (không cần với roundcube)
clientIdstringBắt buộcClient ID của app Azure (không cần với roundcube)
passwordstringTùy chọnMật khẩu tài khoản (bắt buộc với roundcube)
mode"oauth" | "graph" | "roundcube"Tùy chọnMặc định "oauth".
const res = await fetch('https://likemmo.tech/api/v1/read-mail', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    mode: 'oauth',
    email: 'yourmail@hotmail.com',
    refreshToken: 'M.C5...',
    clientId: '04b07795-...',
  }),
})

const data = await res.json()
if (data.success) console.log(data.messages[0]?.extractedCode?.code)
else console.error(data.error)

AccountResult

FieldTypeMô tả
emailstringEmail của tài khoản
status"ok" | "empty" | "error"ok: có thư · empty: hộp thư trống · error: đọc lỗi
codestring?Code mới nhất phát hiện được (nếu có)
messagesMailMessage[]Danh sách thư, mới nhất trước
errorstring?Lý do lỗi khi status = error

Mã lỗi

HTTPMô tả
400Thiếu accounts[] hoặc thiếu email/refreshToken/clientId
429Vượt rate limit (60 request/phút/IP)
502Đọc lỗi (chỉ với luồng đơn) — xem field error

Lưu ý

  • API không lưu email, token hay nội dung thư. Chỉ đếm lượt gọi cho thống kê.
  • Luồng hàng loạt tối đa 500 tài khoản mỗi request, hệ thống tự chia lô xử lý.
  • Nếu mode=oauth không đọc được, thử mode=graph. Mọi lỗi nằm trong field error của từng tài khoản.