When an email arrives in your agent's inbox, you do not want to deal with raw MIME parsing, HTML stripping, and regex matching. AgentMailr does this work automatically and returns clean structured data.
What Gets Extracted
Every email response from the API includes a parsed object:
{
"parsed": {
"otp_codes": ["847291"],
"verification_links": ["https://example.com/verify?token=abc"],
"magic_links": [],
"backup_codes": [],
"category": "verification",
"summary": "Verify your email — code: 847291",
"action_required": true,
"requires_browser": false,
"code_expiry": "2026-03-27T10:45:00Z",
"confidence": 0.95
}
}
OTP Codes
Extracted using six regex patterns that cover the most common phrasing used in production OTP emails. Filtered to remove false positives like years and prices.
Verification Links
URLs containing patterns like /verify, /confirm, /activate, or token query parameters. These are the links users click to complete email verification.
Categories
Emails are classified into categories: verification, security, transactional, notification, newsletter, conversation, and calendar. Your agent can route emails to different handlers based on category.
Code Expiry
If the email mentions an expiry time ("code expires in 10 minutes"), the absolute expiry timestamp is extracted and returned. Your agent can check this before attempting to use the code.
Using the Data
const email = await readEmail(inboxId, emailId);
if (email.parsed.otp_codes.length > 0) {
const code = email.parsed.otp_codes[0];
await submitOtp(code);
} else if (email.parsed.verification_links.length > 0) {
const link = email.parsed.verification_links[0];
await page.goto(link);
}