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

# Schedule a Report

> EcoMail Hub users schedule recurring report emails for daily, weekly, or monthly delivery.

## Real-World Example

Maya wants the operations team to receive a weekly Notice Responses report every Monday. She creates a scheduled export, selects Notice Responses, chooses Weekly, and enters multiple recipient emails separated by commas.

The scheduled command later generates the report, emails the CSV, updates last sent time, and deletes the temporary export file.

## Visual Flow

```mermaid placement="top-right" actions={true} theme={"system"}
flowchart TD
    A["User creates scheduled export"] --> B["Choose report type, frequency, and emails"]
    B --> C["Schedule is saved as active"]
    C --> D["Daily/weekly/monthly command runs"]
    D --> E{"Schedule due and not paused?"}
    E -->|No| F["Skip schedule"]
    E -->|Yes| G["Generate CSV and email recipients"]
    G --> H["Update last sent and delete temp file"]
    classDef default fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef actor fill:#E0F2FE,stroke:#0284C7,stroke-width:2px,color:#0C4A6E;
    classDef system fill:#F8FAFC,stroke:#64748B,stroke-width:1.5px,color:#0F172A;
    classDef decision fill:#FEF3C7,stroke:#D97706,stroke-width:2px,color:#78350F;
    classDef risk fill:#FEE2E2,stroke:#DC2626,stroke-width:2px,color:#7F1D1D;
    classDef outcome fill:#DCFCE7,stroke:#16A34A,stroke-width:2px,color:#14532D;
    class A,B actor;
    class C,D,G,H system;
    class E decision;
    class F risk;
    linkStyle default stroke:#94A3B8,stroke-width:2px;
```

## Frequencies

| Frequency | Scheduled Command Behavior                                  |
| --------- | ----------------------------------------------------------- |
| Daily     | Runs from the daily CRM schedule export command.            |
| Weekly    | Runs on Monday from the weekly CRM schedule export command. |
| Monthly   | Runs from the monthly CRM schedule export command.          |

## How It Should Work

* It should let users create, edit, pause, resume, and delete scheduled exports.
* It should validate every recipient email.
* It should skip paused schedules.
* It should only send a schedule when it has not been sent within its frequency window.

## How It Should Not Work

* It should not send paused schedules.
* It should not send duplicate reports within the same frequency window.
* It should not send a report if no matching rows exist.

## Developer Notes

* Daily CRM exports run at 11:00, weekly CRM exports run Mondays at 11:15, and monthly CRM exports run at 11:30.
* The email job updates `last_sent_at` after sending.

## Related App Areas

* `app/Livewire/ConsumerResponseManager/ScheduleExport/ListPage.php`
* `app/Livewire/ConsumerResponseManager/ScheduleExport/CreateOrUpdate.php`
* `app/Console/Commands/DailyCRMScheduleExportCommand.php`
* `app/Console/Commands/WeeklyCRMScheduleExportCommand.php`
* `app/Console/Commands/MonthlyCRMScheduleExportCommand.php`
* `app/Jobs/SendCRMScheduleExportEmailJob.php`
