> ## 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 – envoi de facture par e-mail

L’onglet **Messaging** envoie automatiquement la **facture PDF** PrestaShop au client quand une commande Cdiscount / Octopia passe dans un statut choisi.

> Uniquement les commandes du module Cdiscount (`module` = cdiscount).  
> La commande doit déjà avoir un **numéro de facture** PrestaShop.

### 1. Activer

Configuration du module → **Messaging** → **Send invoice by email** :

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

### 2. Orders Statuses (déclencheur)

**Orders Statuses** : choisissez l’état PrestaShop qui déclenche l’envoi  
(*Choose the order status which will trigger the invoice sending*).

Seuls les états **éligibles** apparaissent :  
*Only the eligible states are shown (email set to off, invoice to on)*

→ dans PrestaShop : **facture = Oui**, **e-mail natif = Non** (évite un double envoi).

Ex. : un statut « Facture Cdiscount » dédié, sans mail PrestaShop.

### 3. Choose Mail Template

Sélectionnez le template dans `modules/cdiscount/mails/{langue}/`  
(*File template which will be used to announce the invoice.* / *You can add or edit files from the modules/cdiscount/mail directory*).

Le sujet inclut l’identifiant commande marketplace.

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

PDF joint en plus (CGV, etc.) depuis `modules/cdiscount/pdf/`  
(*Additionnal PDF file to send as attachment…*).

Liste vide : placez le PDF dans ce dossier.

### 5. E-mail client (Paramètres)

**Paramètres** → **Marketplace customers** → **Customer Email** :

- comptes clients individuels si besoin ;
- **domaine** de secours si l’e-mail chiffré Cdiscount n’est pas récupérable
(*Please choose a domain name for the customer's email addresses…*).

Sans adresse valide, l’envoi échoue.

### Déclenchement

Au **changement de statut** vers l’état configuré :

1. commande Cdiscount ;
2. Messaging actif + statut + template ;
3. facture PrestaShop déjà générée ;
4. e-mail au client + PDF facture (+ PDF additionnel si défini).

### Checklist

| Étape | Où |
| ---- | ---- |
| Active = Oui | Messaging |
| Statut déclencheur (invoice on, email off) | Messaging + états PS |
| Template mail | `modules/cdiscount/mails/…` |
| PDF optionnel | `modules/cdiscount/pdf/` |
| Domaine / e-mail client | Paramètres |
| Tester : passer une commande Cdiscount dans le statut | Back-office commande |