send_email
Send emails from specified accounts with support for attachments, CC/BCC, and threaded replies to maintain conversation context in email clients.
Instructions
Send an email using the specified account. Supports replying to emails with proper threading when in_reply_to is provided.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account_name | Yes | The name of the email account to send from. | |
| recipients | Yes | A list of recipient email addresses. | |
| subject | Yes | The subject of the email. | |
| body | Yes | The body of the email. | |
| cc | No | A list of CC email addresses. | |
| bcc | No | A list of BCC email addresses. | |
| html | No | Whether to send the email as HTML (True) or plain text (False). | |
| attachments | No | A list of absolute file paths to attach to the email. Supports common file types (documents, images, archives, etc.). | |
| in_reply_to | No | Message-ID of the email being replied to. Enables proper threading in email clients. | |
| references | No | Space-separated Message-IDs for the thread chain. Usually includes in_reply_to plus ancestors. |
Implementation Reference
- mcp_email_server/app.py:105-161 (handler)MCP tool definition for 'send_email', including registration via @mcp.tool decorator, input schema via Pydantic Field annotations, and handler logic that dispatches to provider-specific email handler.@mcp.tool( description="Send an email using the specified account. Supports replying to emails with proper threading when in_reply_to is provided.", ) async def send_email( account_name: Annotated[str, Field(description="The name of the email account to send from.")], recipients: Annotated[list[str], Field(description="A list of recipient email addresses.")], subject: Annotated[str, Field(description="The subject of the email.")], body: Annotated[str, Field(description="The body of the email.")], cc: Annotated[ list[str] | None, Field(default=None, description="A list of CC email addresses."), ] = None, bcc: Annotated[ list[str] | None, Field(default=None, description="A list of BCC email addresses."), ] = None, html: Annotated[ bool, Field(default=False, description="Whether to send the email as HTML (True) or plain text (False)."), ] = False, attachments: Annotated[ list[str] | None, Field( default=None, description="A list of absolute file paths to attach to the email. Supports common file types (documents, images, archives, etc.).", ), ] = None, in_reply_to: Annotated[ str | None, Field( default=None, description="Message-ID of the email being replied to. Enables proper threading in email clients.", ), ] = None, references: Annotated[ str | None, Field( default=None, description="Space-separated Message-IDs for the thread chain. Usually includes in_reply_to plus ancestors.", ), ] = None, ) -> str: handler = dispatch_handler(account_name) await handler.send_email( recipients, subject, body, cc, bcc, html, attachments, in_reply_to, references, ) recipient_str = ", ".join(recipients) attachment_info = f" with {len(attachments)} attachment(s)" if attachments else "" return f"Email sent successfully to {recipient_str}{attachment_info}"