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.
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.
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.
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.
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.
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.
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.
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.
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.
Sign up at multimail.dev, create a mailbox, and generate an API key. Your key will start with mm_live_.
Install Semantic Kernel and an HTTP client for your language.
pip install semantic-kernel requestsDefine a plugin class with kernel functions for send_email, check_inbox, reply_email, and any other MultiMail operations your workflow needs.
Add the plugin to your kernel instance and configure automatic function calling so the planner can discover email tools.
kernel.add_plugin(MultiMailPlugin(), plugin_name="multimail")Invoke the kernel with a prompt. Review and approve pending emails in the MultiMail dashboard when using gated_send mode.
Email infrastructure built for AI agents. Verifiable identity, graduated oversight, and a 38-tool MCP server. Formally verified in Lean 4.