> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendsculpt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# C# (.NET)

> SendSculpt .NET / C# official client.

<Note>Requires .NET Standard 2.0+ / .NET 6+ and `System.Text.Json`</Note>

## Installation

Install using NuGet:

```bash theme={null}
dotnet add package SendSculpt.Sdk
```

## Quick Start

Initialize the client with your **[API Key](https://sendsculpt.com/settings)**.

```csharp theme={null}
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SendSculpt;

class Program
{
    static async Task Main(string[] args)
    {
        var client = new SendSculptClient("your-api-key");

        var request = new SendEmailRequest
        {
            To = new List<string> { "recipient@example.com" },
            Subject = "Welcome to SendSculpt!",
            FromEmail = "noreply@yourdomain.com",
            BodyHtml = "<h1>Hello!</h1><p>This is a test from C#</p>"
        };

        try
        {
            var response = await client.SendEmailAsync(request);
            Console.WriteLine($"Email sent successfully: {response.MessageId}");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Error sending email: {ex.Message}");
        }
    }
}
```

## Advanced Usage

Send emails utilizing **SendSculpt Templates** and auto-encoded **Attachments**.

```csharp theme={null}
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SendSculpt;

class Program
{
    static async Task Main(string[] args)
    {
        var client = new SendSculptClient("your-api-key");

        var request = new SendEmailRequest
        {
            To = new List<string> { "recipient@example.com" },
            Subject = "Monthly Invoice",
            FromEmail = "billing@yourdomain.com",
            TemplateId = "your-template-id",
            TemplateData = new Dictionary<string, object>
            {
                { "first_name", "John" },
                { "amount", 49.99 }
            },
            Attachments = new List<Attachment>
            {
                new Attachment
                {
                    Filename = "invoice.pdf",
                    FilePath = "/path/to/local/invoice.pdf", // Auto-converted to Base64
                    MimeType = "application/pdf"
                }
            }
        };

        var response = await client.SendEmailAsync(request);
        Console.WriteLine($"Successfully queued. Message Id: {response.MessageId}");
    }
}
```

<Tip>
  The SendSculpt API automatically handles environments based on your API key. Use a Sandbox key for testing and a Live key for
  production.
</Tip>
