Skip to main content
AhaSend supports special email headers that allow you to override default settings and customize email behavior on a per-message basis. These headers give you fine-grained control over tracking, testing, data retention, message organization, and idempotency keys for safe retries, without changing your account-wide settings. Available on Free, Pro and Max. See plans and features.
Header Usage: All AhaSend special headers are removed before email delivery and are never visible to recipients. They’re used only to control AhaSend’s processing behavior.

Available special headers

Tracking Control

Override open and click tracking settings for individual emails

Sandbox Testing

Control sandbox mode behavior and simulated outcomes

Data Retention

Customize data retention policies per email

Message Tagging

Add custom tags for organization and filtering

Idempotency Key

Retry a send without sending the same message twice

Tracking headers

Control email tracking behavior on a per-message basis, overriding your account-wide settings.
Privacy Considerations: Email tracking has privacy implications. Many email clients block remote content loading, and some providers prefetch content, which can lead to inaccurate tracking results.
Header names are case-insensitive. This page uses AhaSend- casing for readability.

Open tracking header

Header: ahasend-track-opens
Values: true | false
Purpose: Enable or disable open tracking for individual emails
Open Tracking Requirements: The sending domain’s tracking domain must be set up, or the message is sent without tracking. Only HTML emails are supported.
SMTP Example

Click tracking header

Header: ahasend-track-clicks
Values: true | false
Purpose: Enable or disable click tracking for individual emails
Click Tracking Requirements: The sending domain’s tracking domain must be set up, or the message is sent without tracking. Only HTML emails with http:// and https:// links are supported.
SMTP Example
To exclude specific links from click tracking while keeping it enabled for the email, add the data-as-no-track attribute:

Sandbox headers

Control sandbox mode behavior for testing without affecting real email delivery.

Sandbox mode header

Header: AhaSend-Sandbox
Values: true | 1
Purpose: Enable sandbox mode for individual emails, even with production credentials
SMTP Example

Sandbox result header

Header: AhaSend-Sandbox-Result
Values: deliver | bounce | defer | fail | suppress
Purpose: Control the simulated outcome for sandbox emails
  • deliver - Simulates successful delivery (default)
  • bounce - Simulates a hard bounce
  • defer - Simulates temporary delivery deferral
  • fail - Simulates permanent delivery failure
  • suppress - Simulates suppression list blocking
SMTP Example
Header names are case-insensitive. See the SMTP language examples for setting them in your library.

Retention headers

Customize data retention policies for individual emails, overriding your account defaults.

Message retention headers

AhaSend provides two types of retention control for different aspects of your email data:
Header: ahasend-metadata-retention
Values: 1 day to your plan’s maximum
Purpose: Control how long metadata and delivery logs are retained
Includes delivery status, timestamps, recipient information, and tracking data.
Header: ahasend-data-retention
Values: Within your plan’s range; 0 needs approval
Purpose: Control how long the actual email content is retained
Includes email body, attachments, and complete message content. Set to 0 for immediate deletion after processing.

Retention examples

SMTP Example

Retention use cases

High Security

For emails containing sensitive data you can disable data retention to prevent it from being stored in our database:
  • ahasend-metadata-retention: 1-3 days
  • ahasend-data-retention: 0 days
Use for: Sensitive communications, financial data, personal information

Message tags header

Add custom tags to emails for organization, filtering, and analytics. Header: ahasend-tags
Format: Comma-separated list of tags
Limits:
  • Maximum 10 tags per email
  • Each tag maximum 64 characters
  • Tags are case-sensitive
Pro Tip: Use tags consistently across your emails to build powerful filtering and analytics. Start with basic categories like email type and campaign, then expand based on your tracking needs.

Tag usage examples

SMTP Example

Tag best practices

  • Use lowercase with hyphens: welcome-series, product-update
  • Be descriptive: password-reset vs reset
  • Use consistent naming across campaigns
  • Consider hierarchical tags: email-type:welcome, campaign:q1-2024
  • Campaign tracking: campaign:black-friday, campaign:welcome-series
  • Email types: transactional, marketing, notification
  • User segments: premium-users, trial-users, enterprise
  • Content categories: product-updates, security-alerts, newsletters

Idempotency key header

Retry an SMTP send safely when you do not know whether AhaSend accepted it. Header: ahasend-idempotency-key
Values: A key of 1 to 255 bytes, such as a UUID
Purpose: Send a message again without a second copy to the same recipient
The header is optional. Make a new key for each message, and save it with the message in your application. If your client does not get the answer to a send, for example because the connection closed, send the same message again with the same key. If AhaSend accepted the first message, it accepts the second one and does not send it. A quick retry can first get a 451 answer; see Answers to a message with a key.
SMTP Example

How the key works

  • Within 24 hours of the first message, a second message from the same account with the same key to the same recipient is accepted and not sent.
  • AhaSend does not compare the content of the messages. Within those 24 hours, a message with the key of an accepted message to that recipient is not sent, also when its content is different. Each new message needs a new key.
  • Each recipient of a message is checked on its own. When a message with a key names a recipient two times, that recipient gets one copy.
  • A sandbox message uses up its key like any other message, so use different keys for sandbox and live sends.
  • AhaSend removes the header before delivery.
  • On a send through the API, this header has no effect, and AhaSend removes it. API v2 uses the Idempotency-Key header of the request. See Idempotency.

Answers to a message with a key

The 250 answer gives an ID for each copy, also for a copy that AhaSend did not send. No stored message has the ID of a copy that was not sent.

Combining headers

You can use multiple special headers together for comprehensive email customization:
SMTP Example

Header reference summary

  • ahasend-track-opens: true | false - Control open tracking
  • ahasend-track-clicks: true | false - Control click tracking
  • Use data-as-no-track attribute to exclude individual links from click tracking
  • AhaSend-Sandbox: true | 1 - Enable sandbox mode
  • AhaSend-Sandbox-Result: deliver | bounce | defer | fail | suppress - Control simulated outcome
  • ahasend-metadata-retention: Integer within your plan’s range - metadata and delivery log retention in days
  • ahasend-data-retention: Integer within your plan’s range - email content retention in days; 0 needs approval
  • ahasend-tags: Comma-separated list - Message tags (max 10 tags, 64 chars each)
  • ahasend-idempotency-key: 1 to 255 bytes, a new key for each message - Within 24 hours, no second message from the same account with the same key to the same recipient

Important notes

Header Processing

🗸 All AhaSend headers are removed before delivery
🗸 Recipients never see these special headers
🗸 Headers only affect AhaSend’s processing behavior

Priority & Overrides

🗸 Per-email headers override account settings
🗸 Headers take effect immediately
🗸 Sandbox headers work with any credential type