Enterprise Email Agents on Azure AI

Connect Azure AI's managed model deployments to MultiMail for sending, reading, and managing email — with enterprise content safety and human oversight.


Azure AI provides enterprise-grade access to OpenAI models and other foundation models with managed deployments, content safety, and governance features. MultiMail gives Azure AI agents the email infrastructure they need to send, receive, and manage email while meeting enterprise compliance requirements.

By integrating MultiMail with Azure AI, enterprises get comprehensive audit trails and governance for AI-initiated email. Azure's content safety handles model-level filtering, MultiMail's oversight modes handle send authorization, and both produce audit logs for compliance. The default gated_send mode means your agent drafts emails but a human approves before delivery.

Connect Azure AI to MultiMail by defining email functions using Azure OpenAI's function calling format and routing calls to the MultiMail REST API. The API is compatible with OpenAI's format, making integration straightforward.

Built for Azure AI developers

Enterprise Governance Alignment

Azure AI's managed deployments demand auditability. MultiMail's comprehensive audit logs and approval workflows align with enterprise governance requirements for AI-initiated communications.

Azure Content Safety + Email Oversight

Azure's content safety filters harmful content at the model level. MultiMail adds email-specific oversight on top, creating defense-in-depth that enterprise security teams require.

Managed Deployment Compatible

MultiMail works with Azure OpenAI's managed endpoints. Your existing Azure deployment handles inference while MultiMail handles email delivery, oversight, and compliance.

Graduated Trust via Oversight Modes

Start with gated_send (agent composes, human approves) and progress to autonomous as trust builds. MultiMail's oversight modes align with enterprise change management processes for AI capabilities.

Compliance-Ready Audit Trail

MultiMail logs every email action with timestamps, actor identity, and approval status. Combined with Azure Monitor and Log Analytics, you get end-to-end traceability for regulatory compliance.


Get started in minutes

Define MultiMail Functions for Azure OpenAI
python
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.models import (
    SystemMessage, UserMessage, AssistantMessage, ToolMessage,
    ChatCompletionsToolDefinition, FunctionDefinition
)
from azure.core.credentials import AzureKeyCredential
import requests
import json

client = ChatCompletionsClient(
    endpoint="https://your-resource.openai.azure.com",
    credential=AzureKeyCredential("your_azure_api_key")
)
MULTIMAIL_API = "https://api.multimail.dev/v1"
MM_HEADERS = {"Authorization": "Bearer mm_live_your_api_key"}

email_tools = [
    ChatCompletionsToolDefinition(
        function=FunctionDefinition(
            name="send_email",
            description="Send an email through MultiMail. In gated_send mode, queues for approval.",
            parameters={
                "type": "object",
                "properties": {
                    "mailbox_id": {"type": "string", "description": "Mailbox to send from"},
                    "to": {"type": "string", "description": "Recipient email"},
                    "subject": {"type": "string", "description": "Subject line"},
                    "body": {"type": "string", "description": "Email body"}
                },
                "required": ["mailbox_id", "to", "subject", "body"]
            }
        )
    ),
    ChatCompletionsToolDefinition(
        function=FunctionDefinition(
            name="check_inbox",
            description="Check inbox for recent messages.",
            parameters={
                "type": "object",
                "properties": {
                    "mailbox_id": {"type": "string", "description": "Mailbox to check"},
                    "limit": {"type": "integer", "description": "Max messages"}
                },
                "required": ["mailbox_id"]
            }
        )
    )
]

Create function definitions using Azure OpenAI's function calling format for email tools.

Build an Email Agent with Azure AI
python
def execute_tool(name, args):
    if name == "send_email":
        resp = requests.post(f"{MULTIMAIL_API}/send", headers=MM_HEADERS, json=args)
    elif name == "check_inbox":
        resp = requests.get(
            f"{MULTIMAIL_API}/mailboxes/{args[&"cm">#039;mailbox_id']}/inbox",
            headers=MM_HEADERS, params={"limit": args.get("limit", 10)}
        )
    elif name == "reply_email":
        resp = requests.post(f"{MULTIMAIL_API}/reply", headers=MM_HEADERS, json=args)
    else:
        return {"error": f"Unknown tool: {name}"}
    return resp.json()

def run_azure_email_agent(user_message, mailbox_id):
    messages = [
        SystemMessage(content=f"You are an email assistant for mailbox {mailbox_id}. "
                     f"Emails use gated_send mode and queue for human approval."),
        UserMessage(content=user_message)
    ]
    while True:
        response = client.complete(
            model="gpt-4o",
            messages=messages,
            tools=email_tools
        )
        msg = response.choices[0].message
        if msg.tool_calls:
            messages.append(AssistantMessage(tool_calls=msg.tool_calls))
            for tc in msg.tool_calls:
                result = execute_tool(
                    tc.function.name,
                    json.loads(tc.function.arguments)
                )
                messages.append(ToolMessage(
                    tool_call_id=tc.id,
                    content=json.dumps(result)
                ))
        else:
            return msg.content

print(run_azure_email_agent("Check my inbox", "mbx_abc123"))

Create an agentic loop using Azure AI's chat completions with MultiMail tools.

Azure OpenAI SDK Alternative
python
from openai import AzureOpenAI
import json

client = AzureOpenAI(
    azure_endpoint="https://your-resource.openai.azure.com",
    api_key="your_azure_api_key",
    api_version="2024-10-21"
)

"cm"># Same tool format as OpenAI
email_functions = [
    {
        "type": "function",
        "function": {
            "name": "send_email",
            "description": "Send an email. In gated_send mode, queues for approval.",
            "parameters": {
                "type": "object",
                "properties": {
                    "mailbox_id": {"type": "string"},
                    "to": {"type": "string"},
                    "subject": {"type": "string"},
                    "body": {"type": "string"}
                },
                "required": ["mailbox_id", "to", "subject", "body"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="gpt-4o",  "cm"># Your Azure deployment name
    messages=[
        {"role": "system", "content": "Email assistant. gated_send mode."},
        {"role": "user", "content": "Send a meeting reminder to [email protected]"}
    ],
    tools=email_functions
)

Use the Azure OpenAI Python SDK for a more familiar API if migrating from OpenAI.


Step by step

1

Create a MultiMail Account and API Key

Sign up at multimail.dev, create a mailbox, and generate an API key. Store it in Azure Key Vault for secure access from your application.

2

Install Dependencies

Install the Azure AI Inference SDK or Azure OpenAI SDK, plus requests for calling the MultiMail API.

bash
pip install azure-ai-inference requests
3

Deploy a Model in Azure

Deploy GPT-4o or another model with function calling support in your Azure AI resource. Note the endpoint URL and deployment name.

4

Build the Agent Loop

Implement a loop that sends messages to Azure AI, checks for tool calls, executes tools against MultiMail, and returns results.

bash
response = client.complete(
    model="gpt-4o",
    messages=messages,
    tools=email_tools
)
5

Approve Pending Emails

If your mailbox uses gated_send mode (the default), review and approve pending emails in the MultiMail dashboard before they are delivered.


Common questions

Should I use the Azure AI Inference SDK or Azure OpenAI SDK?
Both work with MultiMail. The Azure OpenAI SDK provides a familiar interface if you are migrating from OpenAI's API. The Azure AI Inference SDK supports a broader range of models beyond OpenAI. Choose based on which models you plan to use.
How does Azure Content Safety interact with MultiMail's oversight?
They work as independent layers. Azure Content Safety filters harmful content at the model level before function calls are generated. MultiMail's oversight modes control whether emails are actually sent — gated_send queues them for human approval regardless of content safety results.
What happens when my agent sends an email in gated_send mode?
In gated_send mode, the MultiMail API returns a success response with a pending status. The email is queued for human review in the MultiMail dashboard. Once approved, it is delivered. Your agent can check status via the list_pending endpoint.
How do I handle API key security in Azure?
Store the MultiMail API key in Azure Key Vault and retrieve it at runtime using managed identity. Never hardcode API keys in application code. Use Azure's RBAC to control which services can access the key vault secret.
Is there rate limiting on the MultiMail API?
Rate limits depend on your plan tier. The Starter (free) plan allows 200 emails per month, while paid plans range from 5,000 to 150,000. The API returns standard 429 responses when limits are reached, which your agent can handle with retry logic.

Explore more

The only agent email with a verifiable sender

Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.