PhoenixKitWeb.Controllers.EmailExportController (phoenix_kit v1.6.16)

View Source

Controller for exporting email tracking data to CSV format.

Provides server-side CSV export functionality for email logs, metrics, and blocklist data. Supports filtered exports based on query parameters.

Features

  • Email Logs Export: Export filtered email logs to CSV
  • Metrics Export: Export email analytics and performance data
  • Blocklist Export: Export blocked email addresses
  • Single Email Export: Export individual email details
  • Filter Support: Respects all filtering parameters from LiveViews
  • Large Dataset Streaming: Efficient handling of large exports

Security

Access is restricted to users with admin or owner roles in PhoenixKit. All exports require proper authentication and authorization.

Summary

Functions

Export email blocklist to CSV.

Export single email details to CSV.

Export email logs to CSV based on filter parameters.

Export email metrics data to CSV.

Functions

export_blocklist(conn, params)

Export email blocklist to CSV.

Parameters

  • reason - Filter by block reason (rate_limit, manual, bounce, etc.)

Response

Returns CSV file with blocked email addresses and metadata.

export_email_details(conn, map)

Export single email details to CSV.

Parameters

  • id - Email log ID

Response

Returns CSV file with detailed email information and events.

export_logs(conn, params)

Export email logs to CSV based on filter parameters.

Parameters

  • search - Search query for recipient, subject, or campaign
  • status - Filter by email status (sent, delivered, bounced, etc.)
  • message_tag - Filter by message type (authentication, marketing, etc.)
  • campaign_id - Filter by campaign ID
  • from_date - Start date filter (YYYY-MM-DD)
  • to_date - End date filter (YYYY-MM-DD)

Response

Returns CSV file with appropriate headers for browser download.

export_metrics(conn, params)

Export email metrics data to CSV.

Parameters

  • period - Time period (last_7_days, last_30_days, last_90_days, etc.)
  • group_by - Grouping option (day, week, month, campaign, provider)

Response

Returns CSV file with email metrics and analytics data.