← All posts

A Developer’s Guide to Send Test Emails with Robotomail

Learn how to send test emails with Robotomail. This guide covers provisioning mailboxes, validating deliverability, and testing agent-native workflows.

A Developer’s Guide to Send Test Emails with Robotomail

If you want to send test emails that actually prove your app works, you need more than a simple script. You need an environment that behaves like the real world. This is doubly true if you’re building AI agents that depend on email, where one tiny misconfiguration can leave them talking to a brick wall.

Why Real Email Testing Is Non-Negotiable for AI Agents

A person works on a laptop displaying 'Delivered' and 'Spam' folders, with a cute robot figurine.

For anyone building autonomous AI agents, the old "fire and forget" email test just doesn't cut it anymore. The modern inbox is a fortress. One mistake in your setup, and your agent's critical messages are DOA, buried in a spam folder they'll never escape.

The scale of the problem is massive. By 2026, the world is expected to have 4.73 billion email users, firing off something like 422 billion emails every day. With that much noise, even a small deliverability hiccup means your agent’s emails simply vanish. When a personalized message can lift engagement by 60%, you have to make sure it actually arrives.

The Problem with Hacking Together Consumer Email

This is where you hit the wall with traditional email services. Tools like Gmail or Outlook were built for people, not programs. They assume a human is at the keyboard, which leads to manual logins and browser-based OAuth flows that are total dealbreakers for an autonomous agent.

You need an agent-native solution. Something that gets the unique demands of programmatic, two-way email. That’s exactly the problem Robotomail was built to solve. It gives an AI agent an API to instantly spin up a real mailbox and just start talking.

The core difference is the workflow. Instead of forcing an autonomous agent through a human-centric setup, Robotomail offers a direct, programmatic path to a fully functional inbox.

This approach sidesteps all the usual friction that grinds development to a halt:

  • No Manual Logins: Agents create and access mailboxes with a single API call. That’s it.
  • No OAuth Hell: The entire workflow is code. No browser redirects, no consent screens, no refresh token juggling.
  • Instant, Proper Setup: Mailboxes are provisioned with DKIM, SPF, and DMARC configured right out of the box. Your tests reflect a real production environment from the very first send.

It's About Context and Deliverability, Not Just Sending

Proper testing isn't just about whether an email sent. It's about validating the entire conversation. Can your agent send, get a reply, and respond again, all while keeping the conversational thread intact?

Robotomail handles this by automatically managing email threading, which is the key to building believable, back-and-forth interactions. For a deeper look at building and testing these kinds of systems, other guides on AI Agents can provide a broader perspective.

Bottom line: using a purpose-built tool to send test emails ensures your agent can actually hold a conversation in the wild. You get real deliverability and preserve critical context from the first message it ever sends.

Provisioning Your First Test Mailbox in Minutes

Person typing on a laptop displaying 'Mailbox created' success message for a REST API POST.

Getting an email testing environment running shouldn't take days. No one wants to fight with server configs or wrestle with OAuth flows just to see if their code works. You should be able to spin up a mailbox and start sending.

With Robotomail, you can provision a fully functional, two-way test mailbox with a single API call. It completely bypasses the usual friction. This isn't just a nice-to-have; it’s a direct answer to the maddening complexity of modern email infrastructure.

The demand for agile, automated solutions is why the cloud business email market is projected to hit US$2.2 billion by 2026. You can read the full research on cloud business email trends if you're interested in the market dynamics. The takeaway is that old-school setups requiring manual domain verification or browser-based logins just can't keep up with autonomous agent workflows. An API-first model is the only thing that makes sense.

The core idea here is to bulldoze every barrier between you and the actual work of testing your agent. Whether you live in a REST client, the command line, or an IDE, the result is the same: a real, usable mailbox in seconds.

The Single API Call Advantage

The beauty of Robotomail is its directness. Forget the multi-step dance of DNS records, SMTP credentials, and user permissions. You just make one API call. That’s it.

This single action kicks off everything on the backend, provisioning a complete environment your agent needs to both send test emails and receive replies.

  • Instant Mailbox Creation: A unique email address is generated and assigned on the spot.
  • Automatic Authentication: You get an API key for immediate, secure access. No OAuth dance.
  • Deliverability baked-in: Critical standards like DKIM, SPF, and DMARC are pre-configured so your emails actually land in the inbox.

This whole process eliminates the classic "I'm blocked on setup" delay that kills momentum. You go from zero to a fully operational email testing environment in the time it takes to run one command.

With Robotomail, you aren't just creating an email address; you're provisioning a complete, agent-ready communication channel. The entire lifecycle—from creation to sending and receiving—is managed through a clean, simple API.

Getting Started with Your Preferred Tool

Robotomail is built to slot right into your existing workflow. We’re not here to dictate your tools. You can provision and interact using whatever feels most natural.

Here are the main ways to create your first mailbox:

  1. Using the REST API: For anyone who lives in tools like Postman or Insomnia, a simple POST request is all it takes. This is perfect for quick manual tests or integrating with custom scripts.
  2. Using the Command-Line Interface (CLI): If you're more at home in the terminal, the Robotomail CLI offers a dead-simple command to create and manage mailboxes. It’s ideal for scripting and plugging into your CI/CD pipelines.
  3. Using SDKs (Python, JavaScript, etc.): For a more integrated experience inside your application code, the official SDKs provide a native, language-specific interface. This is the way to go if you're building agents with frameworks like LangChain, CrewAI, or AutoGen.

No matter which path you choose, the outcome is identical. You get an API key and a ready-to-use mailbox, letting you jump straight to what you actually want to do: sending your first test email.

Sending Emails with the API

Alright, you've got a provisioned mailbox. Now for the main event: making your AI agent actually send something. We designed this to be dead simple, getting your agent communicating with just a standard POST request. No messing around.

From there, we'll get into the more interesting stuff, like handling attachments. You'll see how Robotomail manages this with secure, presigned URLs—a method that’s perfect for agent-native workflows that can't just pop up a file picker for a user.

Sending Your First Plain Text Email

Let's start with the basics: a simple plain text message. The goal here is just to confirm your connection works and the email actually goes out. If you're working in frameworks like LangChain, CrewAI, or AutoGen, this is the first building block for any email-based task.

You can do this with a straightforward cURL command or use one of our SDKs. Both hit the same API endpoint, but offer different levels of abstraction depending on how you're building. For anyone embedding this in a CI/CD pipeline, it's worth reading up on recent improvements in regression testing APIs for CI/CD integration to see how this fits into a broader automated testing strategy.

A basic API call breaks down like this:

  • You send a POST request to the messages endpoint.
  • Your API key goes in the request header for auth.
  • The request body is a JSON payload with the sender, recipient, subject, and the plain text body.

That one-and-done action is all it takes to send test emails. There's no SMTP handshake or complex session management to worry about.

The whole point is to abstract away the messy parts of email protocols. For your agent, sending an email should feel like just another function call, not a networking project.

How to Send Test Emails with Attachments

Testing attachments is non-negotiable for agents that need to send reports, invoices, or other documents. But just stuffing a file into a single API request is both clunky and insecure. We handle this with a two-step process using presigned URLs.

This method keeps your API credentials from ever being exposed to the file storage service—it’s a standard best practice for secure file uploads in any modern cloud app. For the nitty-gritty details, you can always jump straight to the official documentation on sending messages.

The workflow is split into two clean phases:

  1. Request an Upload URL: First, your agent hits our API to ask for a temporary, secure URL to upload the attachment. In this request, you just specify the file's name and type.
  2. Upload the File and Send: Your agent then uploads the file directly to that temporary URL. Once that's done, you make the final API call to send the email, simply referencing the now-uploaded file.

This approach neatly separates message composition from file handling. It keeps the core logic clean, which is essential when you're building AI agents that need to be robust and easy to maintain.

Handling Inbound Emails for Two-Way Communication

An AI agent that only talks is just a notification service. For an agent to be truly useful, it needs to do more than just send test emails; it has to listen and react to replies. This is where the real work begins, turning a simple script into a genuine conversational partner.

Robotomail gives you three ways to handle inbound messages: webhooks, server-sent events (SSE), and good old-fashioned polling. This isn't about which one is "best"—it's about giving you the flexibility to choose the right tool for your agent's architecture.

Testing this entire send-and-receive loop is non-negotiable. With projections showing 5.02 billion users sending 422 billion emails daily by 2026—and over 80% of that happening on mobile—your agent has to be ready for real-world chaos. You can dive deeper into the growing email market and its complexities if you're curious. Robotomail's ability to POST emails and then process replies while keeping the thread context is how you prototype this effectively.

Real-Time Notifications With Webhooks and SSE

If your agent needs to react now, webhooks and server-sent events are your answer. Instead of your application constantly asking the server "Anything new yet?", the server tells you the moment a new email lands.

This immediate feedback is what makes responsive, conversational agents possible. A customer support bot, for example, can acknowledge a user’s reply, look up their ticket, and provide a real update within seconds. Not minutes.

  • Webhooks are perfect for server-side applications. Robotomail just sends a POST request to an endpoint you provide, carrying the full payload of the incoming email.
  • Server-Sent Events (SSE) are built for keeping a connection open, letting the server push updates to your agent continuously. It’s a great fit for architectures that maintain a persistent state.

A quick but critical note on security: every inbound event from Robotomail, whether it's a webhook or an SSE stream, is HMAC-signed. This cryptographic signature is your proof that the data is genuinely from us and hasn't been messed with. For an autonomous agent, data integrity isn't optional.

To help you decide which inbound method is right for your agent, here's a quick breakdown of the trade-offs.

Comparing Methods for Handling Inbound Emails

Method Latency Implementation Complexity Best For
Webhooks Milliseconds Low Server-side applications needing instant, event-driven responses.
SSE Milliseconds Medium Agents that need a persistent, real-time stream of events from the server.
Polling Seconds to Minutes Very Low Simple use cases or environments where setting up a public endpoint isn't feasible.

Ultimately, webhooks and SSE are the modern standards for building responsive systems. But sometimes, simpler is better, which brings us to polling.

The Polling Method

Let's be honest: sometimes a real-time setup is overkill. Polling is the classic approach where your agent just asks the Robotomail API for new messages on a set schedule.

Yes, this means a bit of a delay. But it's also dead simple to implement and is often more than enough for many workflows. An agent that only needs to process a batch of emails every few minutes will find polling to be a perfectly good, resource-friendly choice.

The flowchart below gives you a quick mental model for the outbound side of the equation.

A flowchart detailing test email sending methods: use Presigned URL for attachments, otherwise a Simple POST.

As you can see, the decision on how to send is straightforward: if you have attachments, you'll use a secure presigned URL. If not, a simple POST request does the job. Combining this with the right inbound strategy gives your agent a complete, two-way communication channel.

Validating Deliverability and Troubleshooting Issues

An envelope, magnifying glass, and email authentication checks for DKIM, SPF, and DMARC.

Getting a 200 OK from the API is the easy part. The real test is whether your email actually lands in the inbox. If your agent's messages go straight to spam, your workflow is dead on arrival.

This is where most email hacks fall apart. Deliverability is a full-time job of managing DNS records, IP reputation, and authentication protocols. Robotomail handles the worst of it for you, automatically configuring the "big three"—DKIM, SPF, and DMARC—for every mailbox you create. This even applies when you bring your own custom domains, giving your tests a foundation of trust from day one.

But even with perfect authentication, the real world is messy. Building a resilient agent means testing for failure, not just success.

Testing Resilience Against Real-World Constraints

A reliable agent needs to handle system limits gracefully. It's not just about sending an email; it's about what happens when it can't. Robotomail gives you the controls to simulate these exact scenarios.

You should absolutely be testing for these conditions:

  • Per-Mailbox Rate Limiting: What does your agent do when it hits a sending limit? Does it crash? Queue the message for a later retry? Fail silently? Use this feature to find out and build proper backoff logic.
  • Suppression List Management: An agent that keeps emailing invalid addresses will destroy its own sender reputation. Robotomail helps manage suppression lists so you can test how your agent handles bounces and avoids blacklisted contacts.
  • Storage Quotas: Inboxes have limits. Your agent needs a strategy for archiving or deleting old messages. Test what happens when its mailbox gets full to ensure it doesn't just stop working.

This is how you move from functional tests to hardening your agent for production. You need to know it can operate without a human constantly looking over its shoulder.

Deliverability isn't a one-time setup. It's the ongoing practice of maintaining a good sender reputation and ensuring your agent behaves like a responsible citizen of the internet.

Diagnosing Common Deliverability Problems

Sooner or later, an email won't arrive. When you send test emails and they vanish, troubleshooting is everything. Deliverability is a deep and complex topic—understanding related factors like how open tracking in email works can provide a fuller picture.

First, check the basics. Is the recipient address spelled correctly? Is it on a suppression list? Did you accidentally trip a rate limit with a burst of activity?

Robotomail gives you the visibility to answer these questions quickly. You can see whether the problem is in your code, with the recipient's server, or somewhere in between. This direct insight is what lets you fix issues fast and get your agent back to work.

Common Questions (And Honest Answers)

As you start hooking Robotomail into your agent workflows, a few practical questions always come up. Here are the straight answers to the ones we hear most from developers.

How Is Robotomail Different From Mailgun or SendGrid for Testing?

This is a big one. Services like Mailgun and SendGrid are fantastic tools, but they were built for a different job: high-volume, one-way email. Think password resets, receipts, and marketing blasts.

Robotomail is built on a different premise entirely. It’s for creating real, fully-functional mailboxes for AI agents. With a single API call, your agent can provision its own inbox that can both send and receive email autonomously.

It’s designed to sidestep the exact hurdles that bring automated workflows to a screeching halt:

  • No wrestling with SMTP credentials.
  • No browser-based OAuth screens that need a human to click "Allow."
  • No manual domain verification steps that stall your dev loop.

Robotomail is for agents that need to participate in two-way conversations, not just broadcast messages into the void.

Put simply: SendGrid lets your application send mail. Robotomail gives your application an inbox so it can have a conversation.

Can I Test Email Threading and Conversations?

Yes, and you absolutely should. This is a core part of Robotomail and a non-negotiable for any agent that needs to hold a coherent dialogue.

We designed Robotomail to preserve the full context of a conversation, automatically tracking Message-ID and In-Reply-To headers under the hood.

When your agent replies to an email using the API, Robotomail correctly structures the headers so that clients like Gmail or Outlook see it as part of the same thread. This is crucial. It means you can accurately test complex, multi-turn interactions and make sure your agent’s communication feels natural, not disjointed.

What Happens If I Exceed the Rate Limits?

The API will return an error. This is by design.

The free tier has specific send limits, and if you hit them, the API call will fail with a clear error status code. We did this intentionally to give you a built-in way to test your agent's resilience.

Does your agent crash and burn? Or does it gracefully handle the error, maybe queuing the message to try again later? Building that kind of robustness is the difference between a demo and a production-ready agent.

For more demanding scenarios, the Pro plan offers much higher limits, custom domains, and multiple mailboxes. The per-mailbox rate limiting is especially useful, letting you simulate various real-world constraints to ensure your agent behaves predictably under pressure.


Ready to give your AI agent its own inbox? With Robotomail, you can skip the tedious setup and get straight to building what actually matters. Create your first test mailbox for free.