Enterprise Email Agents with Semantic Kernel

Add MultiMail's email infrastructure to Semantic Kernel plugins, giving your enterprise AI agents the ability to send, read, and manage email with full audit trails.


Semantic Kernel is Microsoft's SDK for integrating LLMs into conventional applications. It emphasizes enterprise patterns like plugins, planners, and memory, with strong support across C#, Python, and Java. MultiMail provides the email infrastructure that Semantic Kernel agents need to communicate externally through managed, auditable email channels.

Enterprise teams using Semantic Kernel need auditable AI actions. MultiMail's audit log records every email operation, and the gated approval modes satisfy compliance requirements for AI-initiated communications. By combining Semantic Kernel's plugin architecture with MultiMail's oversight modes, you get enterprise-grade email automation with appropriate human controls.

Integrate MultiMail by creating a Semantic Kernel plugin with kernel functions that call the MultiMail REST API. The plugin pattern makes email capabilities discoverable by the planner and available to any agent in your kernel.

Built for Semantic Kernel developers

Enterprise Compliance

MultiMail's audit log and oversight modes satisfy enterprise requirements for AI-initiated communications. Every email action is recorded with timestamps, agent identity, and approval status — critical for regulated industries.

Plugin Architecture Alignment

Semantic Kernel's plugin system maps cleanly to MultiMail's tool set. Each email operation becomes a kernel function within a MultiMail plugin, discoverable by the planner and composable with other enterprise plugins.

Multi-Language Support

Both Semantic Kernel and MultiMail's REST API work across languages. Whether your enterprise uses C#, Python, or Java for Semantic Kernel, the same MultiMail API endpoints power your email capabilities.

Planner-Friendly Email Operations

Semantic Kernel's planner can automatically compose email workflows from available kernel functions. The planner discovers MultiMail tools and chains them together — check inbox, draft reply, send — without manual orchestration.

Graduated Trust for Enterprise Rollout

Start pilot deployments in gated_all mode where every email action requires approval. Graduate to gated_send or monitored as the system proves reliable, and reserve autonomous mode for fully validated workflows.


Get started in minutes

Create a MultiMail Plugin
python
import requests
import semantic_kernel as sk
from semantic_kernel.functions.kernel_function_decorator import kernel_function

MULTIMAIL_API = "https://api.multimail.dev/v1"
HEADERS = {"Authorization": "Bearer mm_live_your_api_key"}

class MultiMailPlugin:
    @kernel_function(description="Send an email. In gated_send mode, queues for approval.")
    def send_email(self, to: str, subject: str, body: str, mailbox_id: str) -> str:
        resp = requests.post(f"{MULTIMAIL_API}/send", headers=HEADERS, json={
            "mailbox_id": mailbox_id, "to": to,
            "subject": subject, "body": body
        })
        return str(resp.json())

    @kernel_function(description="Check inbox for recent messages.")
    def check_inbox(self, mailbox_id: str, limit: int = 10) -> str:
        resp = requests.get(
            f"{MULTIMAIL_API}/mailboxes/{mailbox_id}/inbox",
            headers=HEADERS, params={"limit": limit}
        )
        return str(resp.json())

    @kernel_function(description="Reply to an email by message ID.")
    def reply_email(self, message_id: str, body: str) -> str:
        resp = requests.post(f"{MULTIMAIL_API}/reply", headers=HEADERS, json={
            "message_id": message_id, "body": body
        })
        return str(resp.json())

    @kernel_function(description="List all mailboxes for the account.")
    def list_mailboxes(self) -> str:
        resp = requests.get(f"{MULTIMAIL_API}/mailboxes", headers=HEADERS)
        return str(resp.json())

Define a Semantic Kernel plugin with kernel functions that wrap MultiMail API endpoints.

Register Plugin and Run Agent
python
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior
from semantic_kernel.contents.chat_history import ChatHistory

kernel = Kernel()

"cm"># Add LLM service
kernel.add_service(OpenAIChatCompletion(
    service_id="chat", ai_model_id="gpt-4o"
))

"cm"># Register MultiMail plugin
kernel.add_plugin(MultiMailPlugin(), plugin_name="multimail")

"cm"># Configure automatic function calling
settings = kernel.get_prompt_execution_settings_from_service_id("chat")
settings.function_choice_behavior = FunctionChoiceBehavior.Auto()

chat_history = ChatHistory()
chat_history.add_system_message(
    "You are an email assistant using MultiMail. The mailbox operates "
    "in gated_send mode — sent emails require human approval before delivery."
)
chat_history.add_user_message("Check my inbox and summarize any unread messages")

result = await kernel.invoke_prompt(
    "{{$chat_history}}",
    chat_history=chat_history,
    settings=settings
)
print(result)

Add the MultiMail plugin to a Semantic Kernel instance and use it with automatic function calling.

C# Plugin Example
csharp
using Microsoft.SemanticKernel;
using System.ComponentModel;
using System.Net.Http.Json;

public class MultiMailPlugin
{
    private readonly HttpClient _client;
    private const string BaseUrl = "https://api.multimail.dev/v1";

    public MultiMailPlugin(string apiKey)
    {
        _client = new HttpClient();
        _client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");
    }

    [KernelFunction, Description("Send an email. In gated_send mode, queues for approval.")]
    public async Task<string> SendEmail(string to, string subject, string body, string mailboxId)
    {
        var response = await _client.PostAsJsonAsync($"{BaseUrl}/send", new
        {
            mailbox_id = mailboxId, to, subject, body
        });
        return await response.Content.ReadAsStringAsync();
    }

    [KernelFunction, Description("Check inbox for recent messages.")]
    public async Task<string> CheckInbox(string mailboxId, int limit = 10)
    {
        var response = await _client.GetAsync($"{BaseUrl}/mailboxes/{mailboxId}/inbox?limit={limit}");
        return await response.Content.ReadAsStringAsync();
    }

    [KernelFunction, Description("Reply to an email by message ID.")]
    public async Task<string> ReplyEmail(string messageId, string body)
    {
        var response = await _client.PostAsJsonAsync($"{BaseUrl}/reply", new
        {
            message_id = messageId, body
        });
        return await response.Content.ReadAsStringAsync();
    }
}

Create the same MultiMail plugin in C# for .NET enterprise applications.


Step by step

1

Create a MultiMail Account and API Key

Sign up at multimail.dev, create a mailbox, and generate an API key. Your key will start with mm_live_.

2

Install Dependencies

Install Semantic Kernel and an HTTP client for your language.

bash
pip install semantic-kernel requests
3

Create the MultiMail Plugin

Define a plugin class with kernel functions for send_email, check_inbox, reply_email, and any other MultiMail operations your workflow needs.

4

Register Plugin with Kernel

Add the plugin to your kernel instance and configure automatic function calling so the planner can discover email tools.

bash
kernel.add_plugin(MultiMailPlugin(), plugin_name="multimail")
5

Run and Review

Invoke the kernel with a prompt. Review and approve pending emails in the MultiMail dashboard when using gated_send mode.


Common questions

Can I use Semantic Kernel's planner to automatically compose email workflows?
Yes. When you register the MultiMail plugin with auto function calling enabled, the planner can discover and chain email operations automatically. It can compose multi-step workflows like checking inbox, reading a specific email, drafting a reply, and sending it — all from a single natural language prompt.
Does the MultiMail plugin work with Semantic Kernel in C#?
Yes. MultiMail's REST API is language-agnostic, so you can create equivalent plugins in C#, Python, or Java. The plugin pattern is the same across languages — define kernel functions that call MultiMail endpoints with HttpClient or requests.
How does MultiMail's audit log support enterprise compliance?
Every email operation — sends, reads, replies, contact changes — is recorded in MultiMail's audit log with timestamps and API key identity. This provides the audit trail that regulated industries require for AI-initiated communications, complementing Semantic Kernel's own telemetry.
Can I use Semantic Kernel's memory with email history?
Yes. You can populate Semantic Kernel's memory with email data fetched from MultiMail's API. This lets the agent recall past conversations and context when composing new emails, providing a richer understanding of ongoing relationships and prior commitments.
What oversight mode should I use for enterprise deployments?
Start with gated_all mode for initial enterprise pilots, which requires approval for all email actions including reads. Move to gated_send once the team is comfortable, which only gates outbound messages. For mature, validated workflows, monitored mode provides visibility without blocking delivery.

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.