MailCode

Read mail and codes from your app

Create a private link for a mailbox once, then read its messages, verification codes and full email HTML as JSON. Reading a link needs no sign-in.

Quick start: private mail API (72-hour or 8-day links)

  1. 1
    Create a link with POST /?action=createCodeLink, your existing app credential and the email you want.
  2. 2
    Read it with GET /getcode/PRIVATE_LINK_TOKEN: no header required.
  3. 3
    Poll the same URL every 15 seconds or more until a code arrives.

The link URL works like a password: anyone who has it can read that mailbox. Links expire 72 hours after creation, or 8 days when created with lifetime=8d. You can also paste a link into the web viewer.

Response fields

FieldMeaning
statussuccess when the newest email has a code. waiting means it has none yet; the inbox may still have mail.
code, message, message_id, received_atThe newest email in the whole mailbox and its code, on every page. code is null if none was detected.
messagesThis page of emails, newest first.
totalNumber of emails, or null if unknown.
page, page_size, has_more, next_pagePaging. next_page is null on the last page.
expires_atWhen the link stops working (Unix seconds).

Each item in messages

FieldMeaning
idMessage id.
codeCode found in this email only, or null. Emails without a code are still listed.
subjectSubject line.
from, from_name, from_addressSender. from is Name <address>.
date, received_atThe email's own Date header, and when the server received it.
htmlThe email's HTML exactly as received, the same as Mailpit shows it. Render it in a sandboxed iframe.
html_rawSame as html, kept for older clients.
html_safeA sanitized copy with no styles, images, links, scripts or forms. Only for inserting directly into your own page; it won't look like the original.
textThe plain-text part, or readable text taken from the HTML.
text_rawThe original plain-text part, or empty.
truncatedtrue if a body was over 200,000 characters and was cut. Then use html_safe.

Missing parts are empty strings. Bodies are decoded parts only, not raw MIME or attachments.

Render emails exactly as received

html is the email as it was sent, so rendering it looks the same as Mailpit. Email HTML comes from strangers, so always load it in a sandboxed iframe, never directly into your page:

const frame = document.createElement('iframe');
// No allow-scripts and no allow-same-origin: the email can't run code or read your page.
frame.setAttribute('sandbox', 'allow-popups allow-popups-to-escape-sandbox');
frame.referrerPolicy = 'no-referrer';
frame.style.cssText = 'width:100%;height:80vh;border:0;background:#fff';
frame.srcdoc = msg.truncated ? msg.html_safe : msg.html;
document.querySelector('#mail').appendChild(frame);

Errors and refresh

HTTPWhen
400Create: invalid or unavailable address. Read: invalid page.
401Create: missing or invalid app credential.
404Read: link invalid, expired or revoked.
429Too many requests. Wait and retry.
502Mail server unavailable. Retry with backoff.

Reuse the same link and refresh no faster than every 15 seconds. Results are cached for 15 seconds, and expiry is checked on every read.

Action API

These endpoints read a mailbox directly by its address. Call them from your own server only. Every query uses the ?action=NAME format.

Authentication

Send an existing application credential in the Authorization header (X-Api-Key also works). Requests without it return Unauthorized. Replace YOUR_TOKEN below with your credential.

curl -H "Authorization: YOUR_TOKEN" "https://email.yamin.bd/?action=getMessages&user=alex&domain=acetaiaterrenere.com"

Domains

Supported: @2ndgmail.com, @acetaiaterrenere.com, @acisdigital.com, @ahccentralcoast.com, @ahradigital.com, @aislingmedical.net, @aleyacomercial.com, @americanfundingllc.com, @andreasfunkl.com, @annmareeblack.com, @antoniojlg.com, @aqhtraining.uk, @aradmins.com, @aramaicestates.com, @asabross.com, @aselsun.com, @atlantictradecommerce.com, @automotovate.com, @av-technology.com, @avignonconsulting.com, @beileinfant.com, @belloservice.com, @blancaguillot.com, @blrecruitingsolutions.com, @bluenotesolution.com, @caedzgroup.com, @cakesonwheels.net, @careeradvisorsrecruiting.com, @cerezomontilla.com, @ceydaorganizasyon.com, @cnptlcable.com, @coachfinderuae.com, @codexiurisabogados.com, @comprodel.com, @conexioncallcenter.com, @continentaltransportationservices.com, @cpdpartners.uk, @cpwhiteproperties.com, @cubiertasymontajesmadrid.com, @dc-executives.com, @dfycatalog.com, @digitalmandala.uk, @doobydash.com, @eaclglobal.com, @eastlaketile.com, @ecopavi.com, @editingforesl.com, @elysiumcf.com, @embroidme-stamford.com, @enkiedificacion.com, @enlifeint.com, @envinaria.com, @ermaconstrucciones.com, @fatmartian.com, @fernandeztorrens.com, @fhweb.net, @firstfixcontractors.com, @flippingdepot.com, @freedomfundinggrp.com, @freshaccounting.net, @galacticmarketingllc.com, @georgehotelhenfield.com, @globaltraineracademy.com, @glovetrainer.com, @gshopt.com, @hamllc.net, @hertimetocode.com, @higher-lending.com, @hostalrestaurantemoyano.com, @hr-email.com, @huricana.com, @ibiella.com, @idealvehiclesolutions.com, @ims123.net, @irismediainc.com, @jamesdhaga.com, @janus27.com, @jerseyrealestateco.com, @jmvirtualassistant.uk, @jromanfotografia.com, @laviled.com, @leadsomatic.net, @libo-conveyor.com, @liseller.net, @llsz.xyz, @loffco.com, @lomatelier.com, @lovelocol.com, @maclanejr.com, @magroupllc.com, @marketingninjas.uk, @mayersalestraining.com, @medicaljobmarketplace.com, @mehmetservetconstruction.com, @mgcantabria.com, @mialanedesign.com, @miracle-trims.com, @ml-agency.net, @modernworldsolutions.com, @momentumadinc.com, @nitcy.site, @tplink.info, @yamin.bd, @zteck.net. Choose the inbox with user=name@acetaiaterrenere.com or user=name&domain=acetaiaterrenere.com. Without a domain, @2ndgmail.com is used. Disabled domains are not listed and are rejected.

Endpoints

GET?action=statusCheck that the service is online.
GET?action=getDomainsList the supported domains.
GET?action=genRandomGenerate a random username.
GET?action=getMessages&user=USERNAME&domain=DOMAINFetch the latest 50 messages for that address.
GET?action=readMessage&user=USERNAME&domain=DOMAIN&id=MESSAGE_IDRead one message's HTML body and extracted codes.
GET?action=deleteSingleMessage&user=USERNAME&domain=DOMAIN&id=MESSAGE_IDDelete one message.
GET?action=deleteInbox&user=USERNAME&domain=DOMAINPermanently clear the inbox for that address.