Search documentation of phoenix_kit

# mix phoenix_kit.email.export (phoenix_kit v1.6.19)

View Source

Mix task to export email tracking data to various formats.

## Usage

    # Export all logs to CSV
    mix phoenix_kit.email.export --format csv

    # Export specific campaign to JSON
    mix phoenix_kit.email.export --format json --campaign newsletter

    # Export logs from date range
    mix phoenix_kit.email.export --from 2025-01-01 --to 2025-01-31

    # Export with custom filters
    mix phoenix_kit.email.export --status delivered --tag authentication --provider aws_ses

## Options

    --format FORMAT       Export format: csv, json (default: csv)
    --output FILE         Output file path (default: stdout)
    --from DATE           Start date (YYYY-MM-DD)
    --to DATE             End date (YYYY-MM-DD)
    --campaign ID         Filter by campaign ID
    --status STATUS       Filter by status (sent, delivered, bounced, etc.)
    --tag TAG             Filter by message tag/type (authentication, marketing, etc.)
    --provider PROVIDER   Filter by email provider (aws_ses, smtp, local, etc.)
    --limit NUMBER        Limit number of records (default: no limit)
    --include-events      Include email events (opens, clicks) in export

## Output Formats

### CSV Format

Exports logs with columns: id, message_id, to, from, subject, status, sent_at, delivered_at, provider, campaign_id

### JSON Format

Exports complete log objects with all fields and optional events array

## Examples

    # Basic CSV export
    mix phoenix_kit.email.export --format csv > email_logs.csv

    # Campaign analysis with events
    mix phoenix_kit.email.export --campaign welcome-series --include-events --format json > campaign_analysis.json

    # Recent bounced emails for investigation
    mix phoenix_kit.email.export --status bounced --from $(date -d '7 days ago' '+%Y-%m-%d') --format csv > recent_bounces.csv

    # Authentication emails analysis
    mix phoenix_kit.email.export --tag authentication --from 2025-01-01 --include-events > auth_emails.csv

    # Provider performance comparison
    mix phoenix_kit.email.export --provider aws_ses --from 2025-01-01 --include-events > ses_performance.csv