> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# SendMail()

## Definition

Sends an email message through the default email sharing service.

Notes:

1. This method can only be called once the **State** has reached **State.Realtime**. Calls to this method in any other State will be silently ignored (in contrast to the implementation for **AddOns**).
2. You MUST configure an email account as a default "Mail" Share Service from the **General Options**.

## Method Return Value

This method does not return a value.

## Syntax

`SendMail(string to, string subject, string text)`

If mail is not received, please check the `Log` tab of the control center for any specific errors which could be related to delivering the message.

## Parameters

| Parameter   | Description           |
| ----------- | --------------------- |
| **to**      | The email recipient   |
| **subject** | Subject line of email |
| **text**    | Message body of email |

## Examples

```csharp
// Generates an email message
SendMail("customer@winners.com", "Trade Alert", "Buy ES");
```