---
title: Send Email with NextViper
description: Learn how to send transactional emails with Nuratix using the NextViper programming language.
---
> For the complete documentation index, see [llms-docs.txt](/llms-docs.txt) or the site index [llms.txt](/llms.txt). Full docs corpus: [llms-full-docs.txt](/llms-full-docs.txt). Prefer markdown URLs (append `.md`) for agent consumption. Product skill: [skill.md](/skill.md).


<p align="center">
  <img src="/docs/images/nextviper-full.png" alt="NextViper language logo" height="80" />
</p>

# NextViper Email Example

[NextViper](https://github.com/nuratix/nextviper) is a high-performance modern programming language with Python-like syntax, lexical closures, fast execution, and built-in standard networking libraries.

You can easily send transactional emails through the Nuratix REST API using NextViper's standard HTTP library `std.http`.

## Prerequisites

1. Install [NextViper](https://github.com/nuratix/nextviper) on your system.
2. Obtain your Nuratix API key from the [Nuratix Dashboard](/dashboard/settings/api-keys).
3. Ensure you have configured and verified your sending domain.

## Code Example

Create a file named `send_email.nv`:

```nextviper
// send_email.nv - Send transactional email via Nuratix using NextViper
import std.http
import std.json
import std.io

// Configure sending payload
let payload = {
    "from": "Acme <hello@nuratix.com>",
    "to": ["delivered@resend.dev"],
    "subject": "Hello from NextViper and Nuratix!",
    "html": "<strong>Welcome!</strong><p>This transactional email was sent using NextViper and the Nuratix API.</p>"
}

// Set up authorization headers
let headers = {
    "Authorization": "Bearer nr_your_api_key_here",
    "Content-Type": "application/json"
}

// Dispatch HTTP POST request to Nuratix API
print("Sending email with NextViper...")
let response = http.post("https://nuratix.com/api/mail/v1/send", payload, headers)

if response.status_code == 200 or response.status_code == 201 {
    print("Email sent successfully!")
    print("Response: " + response.body)
} else {
    print("Failed to send email. Status: " + str(response.status_code))
    print("Error details: " + response.body)
}
```

## Running the Script

Execute the NextViper script using the NextViper interpreter:

```bash
nextviper send_email.nv
```

## Resources

- [NextViper GitHub Repository](https://github.com/nuratix/nextviper)
- [Nuratix API Reference](/docs/api)
