<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SandMail</title>
    <description>The latest articles on DEV Community by SandMail (@sandvpn).</description>
    <link>https://dev.to/sandvpn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3410314%2Fb6241356-81d6-4993-bac3-b5893aa2fa8a.png</url>
      <title>DEV Community: SandMail</title>
      <link>https://dev.to/sandvpn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sandvpn"/>
    <language>en</language>
    <item>
      <title>How to Extract OTP Codes with AI Agents — One API Call</title>
      <dc:creator>SandMail</dc:creator>
      <pubDate>Thu, 16 Apr 2026 12:34:47 +0000</pubDate>
      <link>https://dev.to/sandvpn/how-to-extract-otp-codes-with-ai-agents-one-api-call-557p</link>
      <guid>https://dev.to/sandvpn/how-to-extract-otp-codes-with-ai-agents-one-api-call-557p</guid>
      <description>&lt;p&gt;How to Extract OTP Codes with AI Agents — One API Call&lt;/p&gt;

&lt;p&gt;Every AI agent hits the same wall: email verification. 80% of online services require an OTP to sign up. Your agent can fill forms, click buttons, solve captchas — but it can't check an inbox.&lt;/p&gt;

&lt;p&gt;I built &lt;a href="https://sandmail.dev" rel="noopener noreferrer"&gt;SandMail&lt;/a&gt; to fix this. One API call creates a disposable inbox, waits for the verification email, and returns the OTP code.&lt;/p&gt;

&lt;h2&gt;
  
  
  3 Lines of Code (JavaScript)
&lt;/h2&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { SandMail } from 'sandmail';
const client = new SandMail('sk_live_your_key');

const inbox = await client.createInbox();
const otp = await client.waitForOTP(inbox.email, { timeout: 30 });
console.log(otp.code);       // "847291"
console.log(otp.confidence); // "high"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Python Version
&lt;/h2&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from sandmail import SandMail

client = SandMail("sk_live_your_key")
inbox = client.create_inbox()
otp = client.wait_for_otp(inbox.email, timeout=30)
print(otp.code)  # "847291"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  How OTP Extraction Works
&lt;/h2&gt;

&lt;p&gt;The API parses the email body using pattern matching across &lt;strong&gt;15 languages&lt;/strong&gt; — no AI model needed, just fast regex.&lt;/p&gt;

&lt;p&gt;Supported formats:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Your verification code is 847291" → ✅ high confidence&lt;/li&gt;
&lt;li&gt;"Code: 4829" → ✅ high confidence&lt;/li&gt;
&lt;li&gt;"Ihr Bestätigungscode lautet 847291" (German) → ✅ high confidence&lt;/li&gt;
&lt;li&gt;"验证码：847291" (Chinese) → ✅ high confidence&lt;/li&gt;
&lt;li&gt;Magic links → ✅ detected&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each result includes &lt;code&gt;code&lt;/code&gt;, &lt;code&gt;type&lt;/code&gt;, &lt;code&gt;confidence&lt;/code&gt;, and &lt;code&gt;verification_links&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Real-time with Webhooks
&lt;/h2&gt;

&lt;p&gt;For production pipelines, use webhooks. The OTP is extracted and included directly in the webhook payload:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "event": "message.received",
  "data": {
    "recipient": "agent_x7k@tempyx.com",
    "has_otp": true,
    "otp": {
      "code": "847291",
      "confidence": "high"
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  MCP Server for Claude &amp;amp; Cursor
&lt;/h2&gt;

&lt;p&gt;If you use Claude Code or Cursor, install the MCP server:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g sandmail-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Then ask your agent: &lt;em&gt;"Create a temporary email and get me the verification code from Twitter."&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Not Gmail API?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gmail&lt;/strong&gt;: 250 sends/day limit, OAuth2 complexity, no disposable inboxes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SandMail&lt;/strong&gt;: unlimited inboxes, one API key, OTP extracted automatically&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;Free tier: 500 requests/month, no credit card.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://sandmail.dev" rel="noopener noreferrer"&gt;sandmail.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sandmail.dev/docs" rel="noopener noreferrer"&gt;Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://npmjs.com/package/sandmail" rel="noopener noreferrer"&gt;npm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/sandmail" rel="noopener noreferrer"&gt;pip&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://npmjs.com/package/sandmail-mcp" rel="noopener noreferrer"&gt;MCP Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy to answer any questions!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>python</category>
    </item>
  </channel>
</rss>
