For the complete documentation index, see llms-docs.txt or the site index llms.txt. Full docs corpus: llms-full-docs.txt. Prefer the markdown version of this page at /docs/examples/nextviper/send-email.md. Product capabilities: skill.md. Docs MCP: /docs/mcp. Site MCP: https://nuratix.com/mcp.

Send Email with NextViper

Learn how to send transactional emails with Nuratix using the NextViper programming language.

NextViper language logo

NextViper Email Example

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 on your system.
  2. Obtain your Nuratix API key from the Nuratix Dashboard.
  3. Ensure you have configured and verified your sending domain.

Code Example

Create a file named send_email.nv:

// 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:

nextviper send_email.nv

Resources

Was this page helpful?

Edit this page