> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://doc.common-services.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Messaging – send invoice by email

The **Messaging** tab automatically emails the PrestaShop **invoice PDF** to the customer when a Cdiscount / Octopia order reaches a chosen status.

> Only orders from the Cdiscount module (`module` = cdiscount).  
> The order must already have a PrestaShop **invoice number**.

### 1. Enable

Module configuration → **Messaging** → **Send invoice by email**:

1. **Active** → Yes
(*Activate invoice per email automation. The module will send the email to the customers with the invoice as an attached document (PDF)*)
2. Save

### 2. Orders Statuses (trigger)

**Orders Statuses**: pick the PrestaShop state that triggers sending  
(*Choose the order status which will trigger the invoice sending*).

Only **eligible** states are listed:  
*Only the eligible states are shown (email set to off, invoice to on)*

→ in PrestaShop: **invoice = Yes**, **native email = No** (avoids a double send).

Example: a dedicated “Cdiscount invoice” status with PrestaShop mail disabled.

### 3. Choose Mail Template

Select the template from `modules/cdiscount/mails/{language}/`  
(*File template which will be used to announce the invoice.* / *You can add or edit files from the modules/cdiscount/mail directory*).

The subject includes the marketplace order ID.

### 4. Additionnal File (optional, PS ≥ 1.5)

Extra PDF attachment (T&Cs, etc.) from `modules/cdiscount/pdf/`  
(*Additionnal PDF file to send as attachment…*).

If the list is empty: put the PDF in that folder.

### 5. Customer email (Settings)

**Settings** → **Marketplace customers** → **Customer Email**:

- individual customer accounts if needed;
- fallback **domain** when the encrypted Cdiscount email cannot be retrieved
(*Please choose a domain name for the customer's email addresses…*).

Without a valid address, sending fails.

### When it runs

On **order status change** to the configured state:

1. Cdiscount order;
2. Messaging on + status + template;
3. PrestaShop invoice already generated;
4. email to customer + invoice PDF (+ extra PDF if set).

### Checklist

| Step | Where |
| ---- | ---- |
| Active = Yes | Messaging |
| Trigger status (invoice on, email off) | Messaging + PS order states |
| Mail template | `modules/cdiscount/mails/…` |
| Optional PDF | `modules/cdiscount/pdf/` |
| Domain / customer email | Settings |
| Test: move a Cdiscount order to the trigger status | Order back office |