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

> ## Agent Instructions
> AhaSend stores all message data in the EU. See /facts.
> The API base URL is https://api.ahasend.com. Send the API key in the Authorization: Bearer header. See /api-reference/authentication.
> Use send.ahasend.com for SMTP. Ports 25, 587 and 2525 use STARTTLS. Port 465 uses implicit TLS. See /smtp.
> For send-only integrations, create an API Key v2 under Credentials → Add and scope it to messages:send:{your-domain}. See /send-api/credentials and /api-reference/scopes.

# Send Odoo Email with the AhaSend Modules

> Send Odoo email through AhaSend: delivery tracking in Odoo, alias email by webhook, mailings from a marketing domain, and test copies whose email you read in Odoo.

> [!WARNING]
>
> The Odoo modules for AhaSend are not released yet. To test them, email [support@ahasend.com](mailto:support@ahasend.com) and we give you access to the repository.

The open source Odoo modules for AhaSend connect Odoo to your AhaSend account. Odoo sends its email through AhaSend SMTP, and the modules add five features you can install one by one:

| Module | Feature |
| - | - |
| *Mail tracking for AhaSend* (`mail_tracking_ahasend`) | Shows in Odoo what happened to every email: delivered, deferred, bounced, opened or clicked. |
| *Inbound email for AhaSend* (`mail_inbound_ahasend`) | AhaSend posts email for Odoo's aliases to Odoo within seconds, without a mail server for Odoo to poll. |
| *Email Marketing through AhaSend* (`mass_mailing_ahasend`) | Sends the mailings of Odoo's Email Marketing from a marketing domain of their own, apart from your other email. |
| *AhaSend sandbox for test copies* (`mail_sandbox_ahasend`) | Neutralized copies of your database send their email to the AhaSend sandbox, where you can read it. Nothing is delivered. |
| *AhaSend test inbox* (`mail_sandbox_ahasend_inbox`) | A test copy shows the email it sent in a Test inbox app in Odoo, much like webmail, as each recipient would see it. |

Each one installs *AhaSend* (`mail_ahasend`), which holds the account settings and sets up sending in one click. The modules are licensed under AGPL-3.0 and work with Odoo 18.0 and 19.0. The source code is on GitHub: [AhaSend/odoo-ahasend](https://github.com/AhaSend/odoo-ahasend). Delivery tracking builds on the [`mail_tracking`](https://github.com/OCA/mail/tree/19.0/mail_tracking) module of the Odoo Community Association (OCA).

## Prerequisites

* Odoo 18.0 or 19.0, with administrator access and a way to add modules to the addons path
* A [verified sending domain](https://ahasend.com/docs/domains.md) in AhaSend
* For delivery tracking and inbound email: an address where AhaSend can reach your Odoo over `https://`, such as `https://odoo.example.com`
* For Email Marketing: a second verified domain that only sends your mailings, such as `news.example.com`

## Install the modules

1. Download the branch that matches your Odoo version (`19.0` or `18.0`) of [AhaSend/odoo-ahasend](https://github.com/AhaSend/odoo-ahasend). Until the release, the repository is open to testers only: see the note at the top of this page. For delivery tracking, also download the same branch of [OCA/mail](https://github.com/OCA/mail), which holds `mail_tracking`.
2. Add the folders to the `addons_path` of your Odoo server and restart Odoo.
3. In Odoo, go to **Apps**, click **Update Apps List** and search for **AhaSend**. Install the features you want: **Mail tracking for AhaSend**, **Inbound email for AhaSend**, **Email Marketing through AhaSend**, **AhaSend sandbox for test copies** and **AhaSend test inbox**.

## Create an API key

The modules use the [Management API](https://ahasend.com/docs/api-reference.md) to set themselves up in your account. In **Account Settings → [API Keys](https://dash.ahasend.com/account/-/settings/api-keys)**, create an API key with the [scopes](https://ahasend.com/docs/api-reference/scopes.md) of the features you installed:

| Feature | Scope | Used for |
| - | - | - |
| Sending | `domains:read` | **Send through AhaSend**, to check the sending domain. Without it, Odoo skips the check. |
| | `smtp-credentials:write:all` | **Send through AhaSend** |
| | `smtp-credentials:delete:all` | **Disconnect sending** |
| Delivery tracking | `webhooks:write:all` | **Connect tracking** |
| | `webhooks:delete:all` | **Disconnect tracking** |
| | `messages:read:all` | **Sync from AhaSend**, and **Check AhaSend** on a tracked email |
| | `accounts:read` | **Sync from AhaSend**, to read your retention |
| | `suppressions:read`, `suppressions:write`, `suppressions:delete` | The suppression buttons on a contact |
| Inbound email | `routes:write:all` | **Connect inbound email** |
| | `routes:delete:all` | **Disconnect inbound email** |
| Email Marketing | `domains:read` | **Connect Email Marketing**, **Check the domain in AhaSend**, and the check when you send a mailing |
| | `smtp-credentials:write:all` | **Connect Email Marketing** |
| | `smtp-credentials:delete:all` | **Disconnect Email Marketing** |
| Test copies | `smtp-credentials:write:all` | **Turn on for test copies** |
| Test inbox | `api-keys:write` | **Turn on the test inbox**, and a change of **IP Allow List** |
| | `api-keys:delete` | **Turn off the test inbox** |

The route and SMTP credential scopes also work for one domain, such as `routes:write:{domain}` for your inbound domain. Copy the key's secret right away, together with your account ID. See [API authentication](https://ahasend.com/docs/api-reference/authentication.md).

> [!WARNING]
>
> The SMTP credential and the API key are different credentials. The module's **Secret key** takes the API key. Odoo's outgoing mail server takes an SMTP username and password, which **Send through AhaSend** creates for you.

## Connect your account

**1. Open the AhaSend settings**

In Odoo, go to **Settings → General Settings → Emails** and turn on **Use AhaSend**.

**2. Fill in your account**

* **Account ID**: your AhaSend account ID.
* **Secret key**: the API key's secret.
* **Sending domain** (optional): limits the modules to one sending domain. The tracking webhook and the sandbox credential then only cover that domain, plus the marketing domain when you connect Email Marketing. The suppression buttons only cover the sending domain. Leave it empty for all domains of your account.
* **Odoo URL**: the public `https://` address of your Odoo, where AhaSend sends tracking events and inbound email. Odoo uses its own base URL and only shows this field while that is not an `https://` address. Then fill in the address where AhaSend reaches your Odoo.

Click **Save**. The other AhaSend boxes appear next to **Use AhaSend**: **AhaSend sending**, then those of the installed features, **AhaSend delivery tracking**, **AhaSend inbound email**, **AhaSend for test databases**, **Test inbox in Odoo** and **AhaSend toolbox**. Email Marketing has its own settings, under **Settings → Email Marketing**.

While sending, tracking, inbound email or Email Marketing is connected, Odoo does not let you turn **Use AhaSend** off: disconnect them first, so that no webhook, route or credential stays active in your AhaSend account.

## Send Odoo's email through AhaSend

Odoo sends through AhaSend SMTP. Tracking and test copies both start from there.

1. In the AhaSend settings, fill in **Sending domain** with your verified sending domain.
2. In the **AhaSend sending** box, click **Send through AhaSend**.

Odoo then:

* creates an SMTP credential named *Odoo (your database)* in AhaSend that can only send from the sending domain;
* adds the outgoing mail server **AhaSend**, which sends for senders on that domain.

Odoo refuses a domain that is not in your account, not verified or paused. A new SMTP credential can take up to 2 minutes to work, so wait a moment before you send the first email.

The From address of every email must be on your sending domain. Set **Alias Domain** in the same **Emails** section to the sending domain, so that Odoo sends its notifications from it. Email from a sender on another domain does not go through this mail server.

**Disconnect sending** deletes the SMTP credential in AhaSend and the mail server in Odoo. While sending is connected, Odoo does not let you change the sending domain.

### Add the mail server yourself

To use an [SMTP credential](https://ahasend.com/docs/smtp/credentials.md) you created in the dashboard instead, add the mail server by hand:

1. In Odoo, go to **Settings → General Settings → Emails**.
2. Turn on **Use Custom Email Servers** and click **Save**.
3. Click **Outgoing Email Servers**, then **New**.
4. Fill in the server with the values below.
5. Click **Test Connection**. When Odoo confirms the connection, save the server.

At the top of the form:

| Field | Value |
| - | - |
| Name | A name you recognize, such as `AhaSend` |
| FROM Filtering | Your verified sending domain, such as `email.example.com`. Odoo then uses this server for email from that domain. |
| Authenticate with | Username |

On the **Connection** tab:

| Field | Value |
| - | - |
| Connection Encryption | **TLS (STARTTLS), encryption and validation** on Odoo 19, **TLS (STARTTLS)** on Odoo 18 |
| SMTP Server | `send.ahasend.com` |
| SMTP Port | `587` |
| Username | The username of your AhaSend [SMTP credential](https://ahasend.com/docs/smtp/credentials.md) |
| Password | The password of your AhaSend SMTP credential |

The From address of every email must be on your verified sending domain. See [SMTP settings](https://ahasend.com/docs/smtp.md) for the other ports.

## Delivery tracking

### Connect tracking

In the **AhaSend delivery tracking** box, click **Connect tracking**. Odoo creates a webhook named *Odoo mail tracking (your database)* in AhaSend with the message events and the Suppression Created event, and stores its signing secret. The box then shows **Connected**, and the webhook appears on the [Webhooks page](https://dash.ahasend.com/account/-/developers/webhooks) of the dashboard.

**Disconnect tracking** deletes the webhook again. Odoo then stops receiving tracking events; the contact buttons keep working, since they only need the API key.

### Send a test email

1. Open a contact with an email address you can read, and use **Send message** in the chatter. A log note is not emailed.
2. Click the envelope icon next to the message in the chatter to open its tracking. It shows **Delivered** within seconds.
3. Open the email. The tracking changes to **Opened**.

Opens and clicks are only reported when [open and click tracking](https://ahasend.com/docs/tracking/open-tracking.md) is on for your sending domain.

### What Odoo shows

The module turns AhaSend's [message events](https://ahasend.com/docs/api-reference/webhooks.md) into the statuses of Odoo's mail tracking:

| AhaSend event | Odoo status |
| - | - |
| `message.delivered` | Delivered |
| `message.transient_error` | Deferred |
| `message.bounced` | Bounced |
| `message.failed` | Soft bounced |
| `message.suppressed` | Rejected |
| `message.opened` | Opened |
| `message.clicked` | Opened, with the click in the event list |
| `message.unsubscribed` | Unsubscribed |
| `message.complained` | Spam |

Odoo links each event to its email by the Message-ID header and the recipient address, so events for mail that another system sent are ignored. Opens and clicks that AhaSend detects as bots are ignored too. An event that arrives late never moves a status backwards: a late delivery event does not turn an opened email back into delivered.

A recipient who unsubscribes with an AhaSend [unsubscribe link](https://ahasend.com/docs/campaigns/unsubscribe.md), or who reports an email as spam, is [suppressed](https://ahasend.com/docs/bounces.md) by AhaSend for the sending domain. Odoo gets the [`suppression.created`](https://ahasend.com/docs/api-reference/webhooks/suppression-created) event for it and puts the address on its blacklist, so the mailings of Email Marketing skip the address too.

### Sync from AhaSend

When Odoo missed webhook events, for example while it was down, click **Sync from AhaSend** in the **AhaSend toolbox** box. Odoo fetches the current status of every email of the last 2 days that is still sent, deferred or delivered, and shows how many got a new status.

The sync goes back no further than AhaSend keeps the metadata of your messages: with a message metadata [retention](https://ahasend.com/docs/retention.md) of 1 day, it checks the last day. How long AhaSend keeps the content of your messages does not matter. When your account has more email than one run can check, Odoo keeps what it found and tells you to run the sync again.

### Check a single email

An administrator can click **Check AhaSend** on a tracking record to fetch the status of that one email, whatever its age. This works as long as AhaSend still keeps the message, which depends on your plan and [retention settings](https://ahasend.com/docs/retention.md).

### Manage suppressions from a contact

On a contact, administrators see three AhaSend buttons next to **Email bounced**:

* **Check suppression** marks the contact as bounced when AhaSend [suppresses](https://ahasend.com/docs/bounces.md) the address, and removes the mark when it no longer does.
* **Suppress** adds the address to your AhaSend suppressions for 365 days.
* **Remove suppression** removes it again.

With a **Sending domain** set, these buttons only look at suppressions for that domain.

### Create the webhook yourself

To create the webhook in the dashboard instead of with **Connect tracking**, turn on Odoo's developer mode. The **AhaSend delivery tracking** box then shows a **Manual webhook setup** section.

1. Copy the **Endpoint URL**. It has the form `https://odoo.example.com/mail/tracking/ahasend/<database>`.
2. In the dashboard, [create a webhook](https://ahasend.com/docs/integrations/webhooks.md#creating-webhooks) with that endpoint URL. Send all events, or at least the message events and **Suppression Created**: Odoo ignores the other events.
3. Copy the webhook's secret into **Webhook secret** in Odoo and save.

## Inbound email

AhaSend receives the email for Odoo's aliases, such as `sales@odoo.example.com`, and posts each one to Odoo with a [route](https://ahasend.com/docs/integrations/routing.md). Odoo's mail gateway handles it like email from a mail server: a reply lands on the record it answers, and an email to an alias creates a record, such as a lead or a ticket. Attachments and inline images are kept.

### Prepare a domain for Odoo's aliases

AhaSend receives the email of every address on the domain, so use a subdomain that only Odoo uses, such as `odoo.example.com`.

> [!WARNING]
>
> Do not point the MX record of the domain your mailboxes use to AhaSend. Its email would then go to Odoo instead of your inboxes.

1. In AhaSend, [add the subdomain](https://ahasend.com/docs/domains.md) to your account.
2. At your DNS provider, add the MX record that its domain details show, pointing to `mx.ahasend.com`. Check it with `dig MX odoo.example.com`.
3. In Odoo, go to **Settings → General Settings → Emails** and set **Alias Domain** to the subdomain. Odoo's aliases then use it.
4. Make sure the [message data retention](https://ahasend.com/docs/retention.md) of your account is 1 day or more. AhaSend discards inbound email at 0 days.

### Connect inbound email

1. In the **AhaSend inbound email** box, check **Inbound domain**. It is filled in with Odoo's alias domain and must be the subdomain from the previous step.
2. Click **Connect inbound email** and confirm. Odoo asks first, because it will get all email that AhaSend receives for the inbound domain, also email for addresses that Odoo does not know. Odoo then creates a route named *Odoo inbound email (your database)* in AhaSend for `*@` the inbound domain, with attachments and headers, and one delivery per email. The box then shows **Connected**.
3. Send an email to one of Odoo's aliases. It shows up in Odoo within seconds.

Connecting does not check the MX record: when it does not point to AhaSend, the route exists but no email reaches it.

An email that matches no alias and no existing record is dropped and logged, as Odoo does with such email from a mail server. An email that reached an alias only through Bcc has no trace of that alias in its headers, so Odoo can only route it when it replies to a known message.

**Disconnect inbound email** deletes the route. AhaSend then stops posting email to Odoo.

### Create the route yourself

To create the route in the dashboard instead, turn on developer mode. The **AhaSend inbound email** box then shows a **Manual route setup** section.

1. Copy the **Endpoint URL**. It has the form `https://odoo.example.com/mail/inbound/ahasend/<database>`.
2. [Create a route](https://ahasend.com/docs/integrations/routing.md) with that endpoint URL and the recipient `*@odoo.example.com`. Turn on attachments, headers and grouping by Message-ID, and leave reply stripping off.
3. Copy the route's secret into **Route secret** in Odoo and save.

## Email Marketing

AhaSend sends transactional and marketing email apart from each other: each sending domain has a [sending type](https://ahasend.com/docs/domains.md#sending-type), Transactional or Marketing. With the Email Marketing module, the mailings of Odoo's Email Marketing go out from a marketing domain of their own, and your other Odoo email stays on the domain it uses today. A large mailing then does not hold up your invoices and password resets.

### Prepare a marketing domain

In AhaSend, [add a domain](https://ahasend.com/docs/domains.md) for your mailings, verify its DNS records and set its [sending type](https://ahasend.com/docs/domains.md#sending-type) to Marketing. Odoo does not change the sending type for you: it only connects a domain that you set to Marketing yourself. Use a subdomain that sends nothing else, such as `news.example.com`.

> [!WARNING]
>
> Do not use the domain of your other Odoo email. Every email from a Marketing domain goes out as marketing email, with unsubscribe headers. Odoo refuses the domain of a company's email address, an alias domain, the **Sending domain** of the AhaSend settings and a domain that another outgoing mail server sends from.

### Connect Email Marketing

1. In Odoo, go to **Settings → Email Marketing**. In the **Email Marketing through AhaSend** setting, fill in **Marketing domain**.
2. Click **Connect Email Marketing**.

Odoo then:

* checks that the domain is in your account, verified, set to Marketing and not [paused](https://ahasend.com/docs/domains.md#why-is-sending-paused-on-my-domain);
* creates an SMTP credential named *Odoo Email Marketing (your database)* that can only send from that domain;
* adds the outgoing mail server **AhaSend marketing** and makes it the **Dedicated Server** of Email Marketing;
* fills in **Send from**, the sender of new mailings: the name of your company, with the first part of its email address on the marketing domain. Change it to any address on that domain.

Odoo refuses a domain that is set to Transactional and tells you to change it in AhaSend first. Wait a few minutes before you send the first mailing: a new SMTP credential can take up to 2 minutes to work, and a change of the sending type up to five. While AhaSend still refuses the new login, Odoo stops the mailing when you send it and tells you to try again.

**Check the domain in AhaSend** shows whether the domain is still verified, set to Marketing and not paused.

**Disconnect Email Marketing** deletes the SMTP credential in AhaSend and the mail server in Odoo. Mailings that are not sent yet then go out through your other mail servers. The domain keeps the sending type Marketing.

### Send a mailing

Create a mailing as usual. It uses the **AhaSend marketing** mail server, and **Send From** on its **Settings** tab is your marketing sender. Mailings count towards your [daily marketing limit](https://ahasend.com/docs/campaigns/marketing-limit.md).

A mailing shows a warning when:

* its **Send From** address is not on the marketing domain. AhaSend refuses the email of such a mailing, since the credential can only send from that domain;
* it has no mail server, like a draft from before you connected. Click **Use the AhaSend marketing server** in the warning.

When you click **Send** or **Schedule**, Odoo asks AhaSend how the marketing domain is set. It stops the mailing when the domain is set to Transactional, when AhaSend paused it, or when it is no longer in your account. When AhaSend cannot be reached, the mailing goes ahead.

### Unsubscribes

Odoo adds its own unsubscribe link and one-click unsubscribe headers to every mailing. AhaSend [keeps those headers](https://ahasend.com/docs/campaigns/unsubscribe.md#can-i-use-my-own-list-unsubscribe-header) when the link is an `https://` address, so run Odoo on `https://`. Odoo then handles each unsubscribe itself, with the mailing list or its blacklist.

When Odoo's address does not start with `https://`, AhaSend replaces the headers with its own link, and the **Email Marketing through AhaSend** setting shows a warning. A recipient who uses that link is suppressed in AhaSend for the marketing domain. With delivery tracking connected, Odoo puts the address on its blacklist as well.

### Mailing statistics

AhaSend handles the bounces of your email. To see bounces and opens in the statistics of a mailing, install delivery tracking and [connect it](#connect-tracking). The OCA module [`mail_tracking_mass_mailing`](https://github.com/OCA/mail/tree/19.0/mail_tracking_mass_mailing) links the events to the mailing. It is in the same repository as `mail_tracking`, and installs itself next to Email Marketing when it is in the addons path.

With a **Sending domain** set in the AhaSend settings, the tracking webhook is limited to that domain. Connecting Email Marketing adds the marketing domain to the webhook.

## Test copies

Copies of a production database, for testing, staging or trying an upgrade, hold the email addresses of real customers. Odoo's neutralization keeps them from emailing anyone by turning all outgoing mail off, so testers cannot see what Odoo would have sent.

With the sandbox module, a neutralized copy sends its email to the AhaSend [sandbox](https://ahasend.com/docs/send-api/sandbox.md), a test inbox, instead. AhaSend accepts every email, never delivers it, and shows it in the dashboard with its HTML and text content and its headers. Sandbox email does not count towards your monthly emails.

### Turn on test copies

In the **production** database, in the **AhaSend for test databases** box, click **Turn on for test copies**. Odoo creates a test-only login: an SMTP credential in sandbox mode named *Odoo test copies (your database)*, limited to the sending domain when one is set, and stores its username and password. The button is safe to click: it changes nothing about how this database delivers its email.

To use a credential you created in the dashboard instead, create an [SMTP credential](https://ahasend.com/docs/smtp/credentials.md) with **Sandbox** turned on. Turn on Odoo's developer mode and fill in its username and password under **Test-only login, set up by hand** in the same box.

AhaSend never delivers email sent with a sandbox credential, so it cannot send real email, also when a database dump with it ends up elsewhere.

To send all email of a database that is not a copy to the sandbox too, for example to test before a go-live, set **Send to the test inbox** to **Always** in the same box. Odoo then sends every email through the **AhaSend sandbox** mail server, and nothing is delivered. Set it back to **Automatic** to deliver email again.

**Remove the test-only login** removes the username and password from Odoo. Copies made after that send no email at all, as with Odoo's own neutralization. The credential stays in your AhaSend account, where you can delete it.

### Make a copy

Neutralize the copy as usual, for example with `odoo-bin neutralize`. The neutralization then:

* turns off Odoo's own neutralization mail server and adds an **AhaSend sandbox** mail server with the sandbox credential;
* adds the `AhaSend-Sandbox: true` header to every email the copy sends, also through another mail server;
* tags each email with `odoo-<database name>`, so you can tell the email of several copies apart;
* removes the API key and the secrets of the tracking webhook and the inbound route, so the copy cannot change anything in your account.

Use the copy as usual. Its email shows up in the dashboard as sandbox messages, and nothing reaches the recipients.

Odoo turns off the scheduled actions of a neutralized copy, also the one that sends the email queue. Email that Odoo sends at once, such as a message you post on a record, reaches the sandbox right away. Email that waits in the queue goes out when you run **Mail: Email Queue Manager** by hand.

A copy that was neutralized before the credential was set keeps Odoo's own neutralization: it sends nothing. To use the sandbox there, turn on developer mode in the copy, fill in the credential under **Test-only login, set up by hand** in its **AhaSend for test databases** box and click **Use the AhaSend test inbox**.

### Test inbox in Odoo

With the test inbox module, testers read the email of a copy in Odoo itself, without the AhaSend dashboard or a separate tool such as Mailpit. A **Test inbox** app lists the email the copy sent, loaded from AhaSend, and shows each email as its recipient would see it. Nothing is delivered.

**Turn it on.** In the **production** database, in the **Test inbox in Odoo** box below **AhaSend for test databases**, click **Turn on the test inbox**. Odoo creates an API key that may only read messages (`messages:read`), limited to the sending domain when one is set. Copies made from then on take this key with them: the neutralization removes the API key of the settings, but keeps this one.

> [!WARNING]
>
> The key can read every email of your sending domain in AhaSend, also the real email of the production database, for as long as AhaSend keeps it. The test inbox only shows sandbox email, but anyone with administrator access to a test copy can take the key and read the other email with it. Fill in **IP Allow List** with the IP addresses or ranges of the servers that run your copies, such as `203.0.113.4` or `198.51.100.0/24`: Odoo gives the key that [IP allow list](https://ahasend.com/docs/security/ip-allow-lists.md), so it works nowhere else. Give Odoo a sending domain of its own, so the key only reaches email that Odoo sent.

**Use it.** In a copy, open the **Test inbox** app from Odoo's main menu, or click the flask icon in the top bar. **Open the test inbox** in the settings box goes there too. The app shows only in a database whose email goes to the sandbox: a neutralized copy, or a database with **Send to the test inbox** set to **Always**. It only shows sandbox email sent from your **Sending domain**, and from the marketing domain of Email Marketing: an email that AhaSend lists with another status, such as one that was delivered for real, or one from another domain, stays out, also when it carries the tag of the copy. Without a **Sending domain** in the settings, email from every domain of your account counts.

* The list shows the newest email first. Search with words, or with `from:`, `to:`, `subject:`, `tag:`, `is:unread`, `has:attachment`, `before:` and `after:` and a date such as `2026-11-30`. Put `-` before a filter to leave it out.
* Each email has the tabs **HTML**, **Text**, **Headers**, **Source** and **Attachments**. The HTML shows at desktop, tablet or phone width, with remote images blocked until you click **Show remote images**. Download the email as an `.eml` file, or a screenshot of it.
* **Link check** opens every link and image of the email and marks the ones that fail. It does not open links that act, such as unsubscribe or confirmation links.
* **HTML check** shows how well mail programs support the HTML and CSS of the email, with the data of [caniemail.com](https://www.caniemail.com).
* Email sent from an Odoo document gets the kind of document as a tag, with a link to the document and to the contact it went to. A contact has a **Test inbox** button with the email sent to it.
* A counter in the top bar shows the unread email, and a notification appears when new email arrives.
* **Send test email** sends a test email through the sandbox mail server of the copy, to an address you choose. It shows up in the test inbox after a few seconds and is never delivered.

The copy loads new email from AhaSend while someone has Odoo open: when the app opens, every 20 seconds and when you click **Refresh**. A copy runs no scheduled actions, so it loads nothing while nobody uses it. AhaSend keeps the content of an email for your account's [data retention](https://ahasend.com/docs/retention.md), so the test inbox loads the content as soon as the email arrives.

**Keep test email for** deletes email from the test inbox after that many days, 30 by default; 0 keeps all email. Users of the group **AhaSend test inbox** see the app; administrators are in it.

To use a key you created in the dashboard instead, give it the scope `messages:read:{domain}` or `messages:read:all`. Turn on developer mode and fill it in under **Test inbox key**, also in a copy made before the key existed. **Turn off the test inbox** removes the key from Odoo and, when Odoo created it, deletes it in AhaSend, so copies stop loading email.

The test inbox has no spam score: the Management API gives none for an email.

## Troubleshooting

> [accordion] AhaSend can only call a public https\:// address
>
> **Connect tracking** and **Connect inbound email** refuse an Odoo URL that does not start with `https://`, such as `http://localhost:8069`. Set **Odoo URL** to the address where AhaSend reaches your Odoo from the internet. To test on your own computer, a tunnel such as [ngrok](https://ngrok.com) gives you a temporary `https://` address.

> [accordion] A button fails with an AhaSend error
>
> When the API key lacks a scope, Odoo names it in the message, such as `webhooks:delete:all`. Add it to the key under **Account Settings → API Keys**, and check the scopes in [Create an API key](#create-an-api-key). When AhaSend does not accept the key at all, check the account ID and the secret key. A Disconnect button that lacks its delete scope also works once you delete the webhook, route or credential in the dashboard yourself: Odoo counts one that is gone as deleted.

> [accordion] Sending fails with 535 AUTH invalid
>
> AhaSend does not accept the SMTP login. Right after **Send through AhaSend** or **Connect Email Marketing** this is expected: a new SMTP credential can take up to 2 minutes to work. Retry the failed emails then. When it stays this way, the credential was deleted in AhaSend: disconnect and connect again.

> [accordion] Emails stay on Sent
>
> Check that the webhook exists and is enabled on the [Webhooks page](https://dash.ahasend.com/account/-/developers/webhooks), and that its endpoint URL reaches your Odoo. Odoo answers `401` when the signature does not match the webhook secret: click **Disconnect tracking** and **Connect tracking** again to store a fresh secret. AhaSend disables a webhook after more than 100 consecutive failed attempts. Click **Sync from AhaSend** to update the emails that were sent in the meantime.

> [accordion] Connect inbound email says the domain is not in your account
>
> AhaSend only routes the email of a domain in your account. [Add the inbound domain](https://ahasend.com/docs/domains.md) in AhaSend and point its MX record to `mx.ahasend.com`, as in [Prepare a domain for Odoo's aliases](#prepare-a-domain-for-odoo’s-aliases). Then click **Connect inbound email** again.

> [accordion] Inbound email does not arrive in Odoo
>
> Check that the MX record of the inbound domain points to `mx.ahasend.com`, that the inbound domain is in your AhaSend account, and that Odoo's **Alias Domain** is the same domain. Check that the route is enabled and that your message data retention is 1 day or more. A sender who gets a bounce with code `556` wrote to a domain that is not in any AhaSend account; see [what AhaSend rejects](https://ahasend.com/docs/integrations/routing.md).

> [accordion] A copy still sends nothing
>
> The sandbox server is only added when the production database held a sandbox credential at the time of the copy. Turn on developer mode in the copy, fill in the credential under **Test-only login, set up by hand** and click **Use the AhaSend test inbox**.

> [accordion] The test inbox stays empty or shows an error
>
> The test inbox needs its key: in the production database, click **Turn on the test inbox** and make a new copy, or fill in **Test inbox key** in the copy. When Odoo says that AhaSend refused the request from this server, the key's IP allow list does not hold the address of the copy's server: add it under **IP Allow List** in the production database. The copy only shows email that it sent itself, tagged with its own database name.

> [accordion] The emails of a mailing fail with 'not authorized to send'
>
> The **Send From** address of the mailing is not on the marketing domain. The SMTP credential of Email Marketing can only send from that domain, so AhaSend refuses each recipient with `authz_id '...' is not authorized to send as tenant '...' or from this domain`; see [scoped credentials](https://ahasend.com/docs/security/scoped-credentials.md). Change **Send From** to an address on the marketing domain and retry the failed emails.

> [accordion] Odoo answers AhaSend with 404
>
> AhaSend calls Odoo without a session, so Odoo must know the database from the request alone. That works when the server runs one database, or when `dbfilter` selects one database for the host name AhaSend calls. A server that lists several databases for that host name answers `404`. The database name at the end of the endpoint URLs does not select the database: it makes Odoo refuse a delivery that was made for another database.

## Related guides

* The modules on GitHub: [AhaSend/odoo-ahasend](https://github.com/AhaSend/odoo-ahasend).
* [SMTP settings](https://ahasend.com/docs/smtp.md), [SMTP credentials](https://ahasend.com/docs/smtp/credentials.md) and [domain setup](https://ahasend.com/docs/domains.md).
* [Webhooks](https://ahasend.com/docs/integrations/webhooks.md), [webhook events](https://ahasend.com/docs/api-reference/webhooks.md) and [API key scopes](https://ahasend.com/docs/api-reference/scopes.md).
* [Inbound routing](https://ahasend.com/docs/integrations/routing.md) and [sandbox mode](https://ahasend.com/docs/send-api/sandbox.md).
* [Sending type](https://ahasend.com/docs/domains.md#sending-type), [daily marketing limit](https://ahasend.com/docs/campaigns/marketing-limit.md) and [unsubscribe headers](https://ahasend.com/docs/campaigns/unsubscribe.md).
* [Bounces and suppressions](https://ahasend.com/docs/bounces.md), [open tracking](https://ahasend.com/docs/tracking/open-tracking.md) and [retention](https://ahasend.com/docs/retention.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.