---
title: "Transactional Email"
description: "The complete toolkit for transactional email. Test with Sandbox, deploy with CLI, and monitor with Webhooks. No credit card required to start."
url: https://ahasend.com/transactional-email
markdown_url: https://ahasend.com/transactional-email.md
lang: en
type: page_builder
published: 2026-02-09
updated: 2026-09-02
---

# Transactional Email

Blazing fast transactional emails.  
Developer-friendly APIs and SMTP relay.  
Fair, transparent pricing.

- [Start for Free](https://dash.ahasend.com/user/register)
- [View Documentation](https://ahasend.com/docs)

Free tier includes **1000 emails/month** • No credit card required

## Get Started in Seconds

Choose your favorite programming language and start sending emails with just a few lines of code.

### CLI

#### cURL

```bash
curl --request POST \
  --url https://api.ahasend.com/v2/accounts/{account_id}/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: UNIQUE-KEY' \
  --data '{
    "from": {
      "email": "noreply@example.com",
      "name": "Example Corp"
    },
    "recipients": [
      {
        "email": "user@example.com",
        "name": "John Doe"
      }
    ],
    "subject": "Welcome to Example Corp",
    "html_content": "<h1>Welcome {{first_name}}!</h1>",
    "text_content": "Welcome {{first_name}}!",
    "substitutions": {
      "first_name": "John"
    }
  }'
```

#### AhaSend CLI

```bash
ahasend messages send \
  --account-id YOUR-ACCOUNT-ID \
  --api-key 'aha-sk-YOUR-API-KEY' \
  --from noreply@awesomeinc.com \
  --to recipient@email.com \
  --subject "Welcome to AhaSend" \
  --html "<h1>Welcome!</h1><p>Thank you for using AhaSend.</p>"
```

Need help getting started? [Check out our documentation](https://ahasend.com/docs) or [contact our support team](https://ahasend.com/contact)

### Go

#### Go

```go
package main

import (
  "context"

  "github.com/AhaSend/ahasend-go"
  "github.com/AhaSend/ahasend-go/api"
  "github.com/AhaSend/ahasend-go/models/common"
  "github.com/AhaSend/ahasend-go/models/requests"
  "github.com/google/uuid"
)

func main() {
  client := api.NewAPIClient(
    api.WithAPIKey("aha-sk-your-64-character-key"),
  )

  accountID := uuid.New()
  ctx := context.Background()

  // SDK automatically handles Idempotency and retries
  client.MessagesAPI.CreateMessage(
    ctx,
    accountID,
    requests.CreateMessageRequest{
      From: common.SenderAddress{
        Email: "info@example.com",
        Name:  ahasend.String("Example Corp."),
      },
      Recipients: []common.Recipient{
        {
          Email: "john@example.com",
          Name:  ahasend.String("John Smith"),
        },
      },
      Subject:     "Hello",
      TextContent: ahasend.String("Hello world!"),
      Sandbox:     ahasend.Bool(true),
    },
  )
}
```

Need help getting started? [Check out our documentation](https://ahasend.com/docs) or [contact our support team](https://ahasend.com/contact)

### JavaScript

Install dependencies:

```bash
npm install @ahasend/sdk
```

#### Node.js

```javascript
import { AhaSendClient } from "@ahasend/sdk";

const ahasend = new AhaSendClient({
  apiKey: process.env.AHASEND_API_KEY,
  accountId: process.env.AHASEND_ACCOUNT_ID,
});

const result = await ahasend.messages.send({
  from: { email: "hello@yourdomain.com", name: "Your App" },
  recipients: [{ email: "user@example.com", name: "Jane" }],
  subject: "Welcome to Your App",
  html_content: "<h1>Welcome aboard</h1>",
  text_content: "Welcome aboard",
  sandbox: true, // validates and queues without delivering
});

const accepted = result.data.filter((entry) =>
  entry.status === "queued" || entry.status === "scheduled"
);
const rejected = result.data.length - accepted.length;
if (rejected > 0 || accepted.length === 0) {
  console.error("AhaSend rejected recipients", { count: rejected });
  process.exitCode = 1;
} else {
  console.log("Sandbox messages accepted", { count: accepted.length });
}
```

Need help getting started? [Check out our documentation](https://ahasend.com/docs) or [contact our support team](https://ahasend.com/contact)

### Python

#### Pyhton

```python
import requests

url = "https://api.ahasend.com/v2/accounts/{account_id}/messages"

payload = {
    "from": {
        "email": "noreply@example.com",
        "name": "Example Corp"
    },
    "recipients": [
        {
            "email": "user@example.com",
            "name": "John Doe",
            "substitutions": { "first_name": "John" }
        }
    ],
    "subject": "Welcome to Example Corp",
    "html_content": "<h1>Welcome {{first_name}}!</h1>",
    "text_content": "Welcome {{first_name}}!"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json",
    "Idempotency-Key": "UNIQUE-KEY",
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

Need help getting started? [Check out our documentation](https://ahasend.com/docs) or [contact our support team](https://ahasend.com/contact)

### PHP

#### PHP

```php
<?php
$email = [
  'from' => [
    'email' => 'noreply@example.com',
    'name' => 'Example Corp'
  ],
  'recipients' => [
    [
      'email' => 'user@example.com',
      'name' => 'John Doe',
      'substitutions' => [
        'first_name' => 'John'
      ]
    ]
  ],
  'subject' => 'Welcome to Example Corp',
  'html_content' => '<h1>Welcome {{first_name}}!</h1>',
  'text_content' => 'Welcome {{first_name}}!',
];
$headers = [
  'Content-type: application/json',
  'Authorization: Bearer <token>',
  'Idempotency-Key: UNIQUE-KEY'
];
$options = [
  'http' => [
    'header'  => implode("\r\n", $headers),
    'method'  => 'POST',
    'content' => json_encode($email)
  ]
];
$context  = stream_context_create($options);
$resp = file_get_contents('https://api.ahasend.com/v2/account/{account_id}/messages', FALSE, $context);
var_export($resp, TRUE);
```

#### Symfony

```php
<?php
// Using Symfony Mailer with AhaSend Bridge
// See: https://github.com/symfony/aha-send-mailer

use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;

class EmailService
{
    public function __construct(
        private MailerInterface $mailer
    ) {}

    public function sendWelcomeEmail(string $userEmail, string $firstName): void
    {
        $email = (new Email())
            ->from('noreply@example.com')
            ->to($userEmail)
            ->subject('Welcome to Example Corp')
            ->html('<h1>Welcome {{first_name}}!</h1>')
            ->text('Welcome {{first_name}}!')
            ->getHeaders()
            ->addTextHeader('X-AhaSend-Substitutions', json_encode([
                'first_name' => $firstName
            ]));

        $this->mailer->send($email);
    }
}

// Configuration in .env:
// MAILER_DSN=ahasend+api://API_KEY@default
```

Need help getting started? [Check out our documentation](https://ahasend.com/docs) or [contact our support team](https://ahasend.com/contact)

### Ruby

#### Ruby

```ruby
require 'uri'
require 'net/http'
require 'json' # Required to convert the hash to a JSON string

url = URI("https://api.ahasend.com/v2/accounts/{account_id}/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request["Idempotency-Key"] = 'UNIQUE-KEY'

# Create a Ruby hash object for the request body
payload = {
  from: {
    email: "noreply@example.com",
    name: "Example Corp"
  },
  recipients: [
    {
      email: "user@example.com",
      name: "John Doe",
      substitutions: {
        first_name: "John"
      }
    }
  ],
  subject: "Welcome to Example Corp",
  html_content: "<h1>Welcome {{first_name}}!</h1>",
  text_content: "Welcome {{first_name}}!"
}

# Encode the Ruby hash into a JSON string for the request body
request.body = payload.to_json

response = http.request(request)
puts response.read_body
```

#### Rails

```ruby
# Using Rails ActionMailer with AhaSend configuration
# config/environments/production.rb

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address: 'smtp.ahasend.com',
  port: 587,
  domain: 'yourdomain.com',
  user_name: 'your_smtp_username',
  password: 'your_smtp_password',
  authentication: 'plain',
  enable_starttls_auto: true
}

# app/mailers/application_mailer.rb
class ApplicationMailer < ActionMailer::Base
  default from: 'noreply@example.com'
  layout 'mailer'
end

# app/mailers/welcome_mailer.rb
class WelcomeMailer < ApplicationMailer
  def welcome_email(user)
    @user = user
    @first_name = user.first_name

    mail(
      to: @user.email,
      subject: 'Welcome to Example Corp',
      template_name: 'welcome'
    )
  end
end

# Usage:
WelcomeMailer.welcome_email(user).deliver_now
```

Need help getting started? [Check out our documentation](https://ahasend.com/docs) or [contact our support team](https://ahasend.com/contact)

## Ready to Build?

Join thousands of developers who trust AhaSend for reliable email delivery. Integrate in minutes, scale to millions.

- [Start Free](https://dash.ahasend.com/user/register)
- [View Documentation](https://ahasend.com/docs)

_No credit card required • 1000 emails/month free_

## See AhaSend in Action

A clean, intuitive dashboard to manage your transactional emails with real-time analytics and delivery tracking.

![AhaSend Dashboard - Email analytics and management interface](https://cms.ahasend.com/sites/default/files/2025-12/dashboard-light.webp)

## Built for Developers

Everything you need to integrate, test, and deploy email functionality with confidence and speed.

_Develop faster locally_

### Your Toolkit in the Terminal

Our powerful [CLI tool](https://ahasend.com/docs/cli) puts the entire platform at your fingertips, dramatically speeding up your workflow.

- Test and debug webhooks and email routes by securely streaming events directly to your localhost.
- Trigger any API event or send test emails right from the command line.
- Manage your entire account and configuration without leaving the terminal.

```shell
$ ahasend auth login --profile local
Enter your AhaSend API key: ****************************************
Enter your AhaSend Account ID: 8b9dcfcf-94f7-477c-8372-0178618ef975
Successfully authenticated and saved profile 'local'
```

_Test Freely, Build Confidently_

### Sandbox Mode

Our true-to-production sandbox modes for [API](https://ahasend.com/docs/send-api/sandbox) and [SMTP](https://ahasend.com/docs/smtp/sandbox) provide a complete, isolated environment for development and testing email flow.

- Develop your entire integration without sending a single real email.
- Mirrors the production requests for true-to-life testing of every feature.
- Simulate specific API responses, webhooks, and even failure modes.
- Go from development to production with zero code changes.

```shell
$ ahasend messages send \
    --sandbox \
    --from info@ahasend.com \
    --to someone@example.com \
    --subject 'Welcome to AhaSend' \
    --text 'Welcome' \
    --output json
{
  "data": [
    {
      "id": "<66cb96e1-d7bd-4d49-b9af-2dae15598e74@ahasend.com>",
      "object": "message",
      "recipient": {
        "email": "someone@example.com",
        "name": "",
        "substitutions": {}
      },
      "status": "queued"
    }
  ],
  "object": "list"
}
```

_Real-time Development_

### Webhook & Inbound Message Routes

Develop and test [webhooks](https://ahasend.com/docs/integrations/webhooks) and inbound message [routes](https://ahasend.com/docs/integrations/routing) directly on your [localhost](https://ahasend.com/docs/cli/commands/webhooks#listen-for-events-development). Stream real-time events to your development environment for seamless debugging and integration testing.

- Listen for webhook events and inbound message routing in real-time.
- Test your webhook handlers without deploying to production.
- Debug message delivery, bounces, and routing logic locally.

```shell
$ ahasend webhooks listen \
    --forward-to http://localhost:3000/ \
    --slim-output
🔌 Webhook connected!
Webhook ID: 1fc8ef7a-9d14-445e-8ace-4f333e888cba
Secret: aha-whsec-VUp1xuZi9TftBhcuE7GqB...SRF8D0rIWOkJDvTOlwYoJ5
Connected at: 22:14:06
Listening for events... (Press Ctrl+C to stop)
────────────────────────────────────────────────────────────
✓ Session established: sess_1757535246_9f34457af66cdd0c
────────────────────────────────────────────────────────────
[22:14:16] 📨 message.reception
────────────────────────────────────────────────────────────
[22:14:16] 📨 message.delivered
────────────────────────────────────────────────────────────
[22:14:16] 📨 message.bounced
────────────────────────────────────────────────────────────
```

_Build Resilient Systems_

### Prevent duplicate requests

With built-in [request idempotency](https://ahasend.com/docs/api-reference/idempotency), you can protect your application from network errors and race conditions, preventing duplicate requests.

- Safely retry API requests after network failures without risk.
- Prevent duplicate emails and other actions by using a unique idempotency key.
- Build more robust, fault-tolerant integrations right from the start.

```shell
$ ahasend messages send \
    --idempotency-key "user-signup-123" \
    --from welcome@ahasend.com \
    --to user@example.com \
    --subject "Welcome!" \
    --text "Welcome to AhaSend!"
✓ Message sent successfully
Message ID: <1fc8ef7a-9d14-445e-8ace-4f333e888cba@ahasend.com>
# Retry the same request (network failure simulation)
$ ahasend messages send \
    --idempotency-key "user-signup-123" \
    --from welcome@ahasend.com \
    --to user@example.com \
    --subject "Welcome!" \
    --text "Welcome to AhaSend!"
⚠ Duplicate request detected - returning original response
Message ID: <1fc8ef7a-9d14-445e-8ace-4f333e888cba@ahasend.com>
```

_Principle Of Least Privilege_

### The Right Permissions, Every Time

With [Scoped API keys](https://ahasend.com/docs/api-reference/scopes), you have granular control over what each part of your application is allowed to do.

- Scope keys by action (e.g., report-only, send-only) and by domain.
- Enforce least privilege for maximum security.
- Shrink the blast radius of a compromised key.
- Restrict each key to trusted source IPs (IPv4/IPv6 or CIDR) with an [IP Allow List](https://ahasend.com/blog/restrict-your-api-keys-specific-ips-ip-allow-lists), so a leaked key is useless from anywhere else.
- Safely create keys for different tenants or services, like a reporting key for just one client's domain.

```shell
$ ahasend keys create \
    --name "reporting-client-ahasend" \
    --scopes "reports:read" \
    --domain "ahasend.com"
✓ API key created successfully
Key: aha-sk-1234567890abcdef...
Scopes: reports:read
Domain: ahasend.com
# Attempting to send email with reports-only key
$ ahasend messages send \
    --api-key "aha-sk-1234..." \
    --from test@acme.com \
    --to user@example.com \
    --subject "Test"
✗ Error: Insufficient permissions - key lacks 'messages:send' scope
```

_Complete Transparency_

### Raw Delivery Logs

Unlike other email providers, we don't hide delivery logs behind paywalls or abstractions. Get complete access to raw delivery attempts, bounce reasons, and detailed error messages for every email.

- Access detailed delivery logs for every message sent through our platform.
- Get raw SMTP error messages and bounce reasons directly from receiving servers.
- Debug delivery issues with complete transparency and detailed timestamps.
- No hidden information - see exactly what happened to every email attempt.

```shell
$ ahasend messages list \
    --status bounced \
    --output json | jq '.data[0].delivery_attempts'
[
  {
    "log": "Requested action not taken: mailbox unavailable...",
    "status": "Bounce",
    "time": "2025-12-25T13:01:16.913Z"
  }
]
```

_Advanced Features_

## Everything You Need to Scale

Comprehensive email infrastructure features designed to grow with your business.

### SMTP Relay

Send emails from any programming language or software using our SMTP relay servers.

[Learn more](https://ahasend.com/free-smtp-server-relay)

### Email API

SMTP is good, but HTTP APIs are more flexible and faster for large senders.

[Learn more](https://ahasend.com/free-email-api)

### Engagement Tracking

Gain insight into your audience with detailed open and click tracking for every email.

[Learn more](https://ahasend.com/docs/tracking/open-tracking)

### Message Retention Policies

Customize retention policies for your message data and metadata.

[Learn more](https://ahasend.com/docs/retention)

### Email Archiving

Automatically archive emails to any S3-compatible service for compliance and long-term storage.

[Learn more](https://ahasend.com/docs/retention/s3)

### DNS Whitelabeling

Provide a seamless, branded experience for your customers with fully white-labeled DNS records.

[Learn more](https://ahasend.com/docs/scale/dns-whitelabel)

### Free Dedicated IPs

We reward high-volume senders with free IPs to protect and manage their reputation.

[Learn more](https://ahasend.com/docs/scale/dedicated-ips)

### IP Pools

Group dedicated IPs into pools to manage sending reputation across different mail streams.

[Learn more](https://ahasend.com/docs/scale/ip-pools)

### Bring Your Own IP (BYOIP)

Import and use your existing IP addresses on our platform for seamless migration.

[Learn more](https://ahasend.com/docs/scale/byoip)

### DKIM rotation

We automatically rotate DKIM keys, enhancing security.

[Learn more](https://ahasend.com/docs/domains#dkim-record-required)

### Management API

Manage domains, webhooks, supressions, routes, statistics, accounts and API keys

[Learn more](https://ahasend.com/docs/api-reference)

### Custom subdomains

personalize your return-path, tracking, subscription (unsubscribe pages), and media subdomains.

_Customer Stories_

## Trusted by Developers Worldwide

Join thousands of developers who've transformed their email infrastructure with AhaSend's reliable delivery and world-class support.

> **Our Best Email Deliverability Ever**
> The best part about using AhaSend is the incredibly supportive team. They worked closely with us to resolve long-standing issues and warnings we had with our transactional email at Virgool. Thanks to their help, we're now experiencing the lowest spam rate in our history. The platform itself is also very intuitive, easy to set up, and integrates smoothly with our existing infrastructure.
> Ali A., CEO @Virgool (via G2) [Read review](https://www.g2.com/products/ahasend/reviews)

> **Exceptional Support and Excellent Service!**
> AhaSend provides an outstanding level of customer support and a seamless, user-friendly service that simplifies our communication needs. The platform is highly reliable and versatile, allowing us to manage campaigns effortlessly, which has significantly boosted our marketing efforts. I also appreciate the constant updates and improvements they bring to the platform.
> Dave F., Founder @Virabase (via G2) [Read review](https://www.g2.com/products/ahasend/reviews)

> **Mindblowingly good**
> I have worked with Brevo, Mailgun, SendQ, Cloudflare email workers, and others ... AhaSend was by far the easiest to set-up. On our latest project we spent hours trying to get the other to work without email being rejected or spam bucketed. With AhaSend we were up and running in 45 minutes, including the implementation of a routing web hook (granted we were just modifying from another provider). Finally, we made a comment about wanting a new feature (passing all email headers to a webhook) ... it was made, documented, and deployed within 45 minutes! Talk about support ... wow! And, it is very cost effective!
> Simon B., CTO @Unbounded.chat (via G2) [Read review](https://www.g2.com/products/ahasend/reviews)

> **Absolutely fantastic service!**
> We've been using AhaSend for a while now, and it comes highly recommended. Absolutely fantastic service!
> Nima A., Founder @BestOfWeb (via Product Hunt) [Read review](https://www.producthunt.com/products/ahasend#Review-743793)

> **AhaSend solved our email headaches**
> We were having ongoing deliverability issues with our previous email provider. After switching to AhaSend, those problems were completely resolved. Emails now land where they should and performance has been much more reliable. The support team is the best! Quick to respond, proactive, and genuinely helpful. They've gone above and beyond to help us get set up and improve our sending. Very happy with AhaSend so far. Highly recommended.
> Rob K., CEO @TeleCalendar (via G2) [Read review](https://www.g2.com/products/ahasend/reviews)

> **So fast and reliable**
> A transactional email service is an essential tool for every startup. I tested the AhaSend service and I'm using it for one of my projects. it's so fast and reliable, providing productive reports. Congratulations to the AhaSend team. 👌
> Atta K., CPO @WishMerge (via Product Hunt) [Read review](https://www.producthunt.com/products/ahasend#Review-743815)

## Ready to Build?

Join thousands of developers who trust AhaSend for reliable email delivery. Integrate in minutes, scale to millions.

- [Start Free](https://dash.ahasend.com/user/register)
- [View Documentation](https://ahasend.com/docs)

_No credit card required • 1000 emails/month free_
