# Odoo: outgoing mail server

> Set Odoo's outgoing mail server to Couryo's SMTP so invoices, quotations and notices reach the inbox, with the right sender and the FROM filter.

Source: https://couryo.com/en/docs/odoo

When Odoo invoices land in spam, it is almost always one of two things: Odoo sends through a server that is not authorized to speak for your domain, or it sends "as" the salesperson (`someone@gmail.com`) through a server that is not Gmail's. Both break SPF, DKIM and DMARC. This guide fixes both.

## Before you start

1. In Couryo, [verify the company domain](https://couryo.com/en/docs/domains.md) (for example, `example.com`).
2. Create an API key with the `send` scope. It is the SMTP password.

## 1. Create the outgoing server

In Odoo, turn on **developer mode** (**Settings > Activate the developer mode**). Then:

- **Odoo 15 or newer:** in **Settings > General Settings**, in the email section, check **Use Custom Email Servers** (on Odoo Online, this option enables your own server) and click **Outgoing Email Servers**.
- **Any version:** **Settings > Technical > Email > Outgoing Mail Servers**.

Create a server with:

| Field | Value |
|---|---|
| Name | `Couryo` |
| FROM Filtering | `example.com` (the verified domain) |
| SMTP Server | `smtp.couryo.com` |
| SMTP Port | `587` |
| Connection Encryption | `TLS (STARTTLS)` (or `SSL/TLS` with port `465`) |
| Authenticate with | Username |
| Username | `couryo` |
| Password | your API key (`ck_live_...`) |
| Priority | lower than the other servers, so it is picked |

Click **Test Connection**. "Connection Test Successful" means the login worked.

## 2. Fix the sender

Odoo uses the email of whoever created the document as the sender. If the salesperson has `someone@gmail.com` on their profile, the invoice goes out "from" a Gmail address, through a server that is not Gmail's: Gmail's DMARC tells receivers to refuse it or send it to spam.

With **FROM Filtering** set, Odoo only uses this server for senders on your domain and rewrites the others to one of your addresses, keeping the person's name. For that, in **Settings > Technical > Parameters > System Parameters**, check:

| Key | Value |
|---|---|
| `mail.catchall.domain` | `example.com` |
| `mail.default.from` | `notifications` (becomes `notifications@example.com`) |

Result: the invoice goes out as "Someone <notifications@example.com>", signed with your domain's DKIM. Replies still come back to Odoo through the catchall address, if you use an incoming server.

Better still: give users their company email (`someone@example.com`).

## 3. Send a test invoice

Open a test invoice and use **Send & Print** to your own email. In the Couryo dashboard, under **Emails**, the message shows up with its timeline and the destination server's answer. If it was refused, the explanation says why.

## Invoices, payment slips and attachments

- Odoo's invoice template already has the button to view the document in the portal. When the person does not need the PDF in the email, the link alone is lighter and less likely to trip a filter.
- **Payment slips as attachments are the worst case:** fake slips in attachments are a common scam, and filters distrust them. Send them as links.
- Avoid subjects with only "Invoice" or "Payment due": "Invoice 2026/0042 from Example, due Nov 10" is clearer for the person and for the filter.

## Common problems

| Symptom | What to do |
|---|---|
| Connection test fails with `535` | username other than `couryo`, or a key that is invalid, revoked or without the `send` scope |
| `550 5.7.1` in Odoo's email queue | the sender is not on a verified domain: check FROM Filtering and `mail.default.from` |
| Odoo keeps using another server | adjust **Priority** and **FROM Filtering**; servers without a filter apply to any sender |
| Emails stuck in **Technical > Email > Emails** with status "Exception" | open the message: the SMTP error shows there, with the code. See [SMTP error codes](https://couryo.com/en/guides/smtp-error-codes.md) |
| Delivered, but in spam | see [Why emails go to spam](https://couryo.com/en/guides/emails-going-to-spam.md) |
