### Start Frontend Development Watch Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/CLAUDE.md Starts the development server with automatic rebuilding on file changes. ```bash npm run start ``` ```bash npx mix watch ``` -------------------------------- ### Install PHP Dependencies Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/README.md Run this command after cloning the repository to install the necessary PHP dependencies. ```bash composer install ``` -------------------------------- ### POST /install_plugin Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Installs a recommended plugin using the WordPress plugin installer. ```APIDOC ## POST /install_plugin ### Description Installs a recommended plugin using the WordPress plugin installer. ### Method POST ### Endpoint /install_plugin ### Parameters #### Request Body - **plugin_slug** (string) - Required - The slug of the plugin to install. ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/README.md Install the required Node.js packages for the project. ```bash npm install ``` -------------------------------- ### Install Plugin via API Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Installs a recommended plugin using its slug via the WordPress plugin installer. Requires 'plugin_slug' in the request body. ```json { "plugin_slug": "plugin-name" } ``` -------------------------------- ### GET /docs Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Fetches documentation articles from the fluentsmtp.com API. This endpoint provides access to help and guide content. ```APIDOC ## GET /docs ### Description Fetches documentation articles from fluentsmtp.com API. ### Method GET ### Endpoint /wp-admin/admin-ajax.php?action=fluent_mail&route=/docs ### Parameters None ### Request Example None ### Response #### Success Response (200) - **docs** (array) - An array of documentation articles. - **title** (string) - **content** (string) - **link** (string) - **category** (object) - **value** (string) - **label** (string) #### Response Example ```json { "docs": [ { "title": "Getting Started", "content": "...", "link": "https://fluentsmtp.com/docs/", "category": { "value": "basics", "label": "Getting Started" } } ] } ``` ``` -------------------------------- ### Logger get() Method Example Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Retrieves paginated email logs. Supports filtering by status, date range, and searching across specific fields. The 'data' array accepts various query parameters. ```php $logs = $logger->get([ 'page' => 1, 'per_page' => 20, 'status' => 'failed', 'date_range' => ['2024-01-01', '2024-01-31'], 'search' => 'to:user@example.com' ]); ``` -------------------------------- ### GET /settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves all current plugin settings, including connection details, email mappings, and miscellaneous configurations. ```APIDOC ## GET /settings ### Description Returns all current plugin settings. ### Method GET ### Endpoint /settings ### Response #### Success Response (200) - **settings** (object) - Contains all plugin settings. ### Response Example ```json { "settings": { "connections": { "md5hash": { "title": "SendGrid", "provider_settings": { "provider": "sendgrid", "sender_email": "from@example.com", "sender_name": "Company", "api_key": "...", "force_from_name": "no", "force_from_email": "yes" } } }, "mappings": { "from@example.com": "md5hash", "other@example.com": "md5hash" }, "misc": { "log_emails": "yes", "log_saved_interval_days": "14", "default_connection": "md5hash", "fallback_connection": "" } } } ``` ``` -------------------------------- ### Example: Setting PHPMailer and Provider Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Demonstrates how to chain the setPhpMailer and setSettings methods to configure an email handler with API credentials and sender information. ```php $handler ->setPhpMailer($phpmailer) ->setSettings([ 'api_key' => 'xxx', 'sender_email' => 'from@example.com', 'sender_name' => 'Company' ]); ``` -------------------------------- ### Retrieve Email Logs Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/INDEX.md This example shows how to retrieve email logs using the `fluentMail()` helper to get the Logger instance. You can filter logs by status, page, and items per page. ```php $logger = fluentMail(\FluentMail\App\Models\Logger::class); $logs = $logger->get([ 'page' => 1, 'per_page' => 20, 'status' => 'failed' ]); ``` -------------------------------- ### Get All Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves all current email settings, including provider connections and mappings. Use this to fetch the complete configuration state. ```php public function index(Settings $settings): mixed ``` -------------------------------- ### make() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Creates an instance of a specified email provider handler class. Use this to get a provider instance by its class name. ```APIDOC ## make() ### Description Creates an instance of a provider handler class. ### Method `make` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Path Parameters - **provider** (string) - Yes - Provider class name (e.g., 'SendGrid', 'Mailgun') ### Returns `BaseHandler` - Configured provider instance ### Throws `InvalidArgumentException` if provider class not found ### Example ```php $sendgridProvider = $factory->make('SendGrid'); $mailgunProvider = $factory->make('Mailgun'); ``` ``` -------------------------------- ### Get All Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Retrieves all plugin settings, including provider connections, sender mappings, and miscellaneous configurations. Use this to access current plugin settings. ```php public function get(): array ``` ```php public function getSettings(): array ``` -------------------------------- ### Get All Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/INDEX.md Retrieves all current settings for Fluent SMTP. This is a read-only operation. ```APIDOC ## GET /wp-admin/admin-ajax.php?action=fluent_mail&route=/settings ### Description Retrieves all current settings for Fluent SMTP. ### Method GET ### Endpoint /wp-admin/admin-ajax.php ### Query Parameters - **action** (string) - Required - Must be set to `fluent_mail`. - **route** (string) - Required - Must be set to `/settings`. - **_wpnonce** (string) - Required - A valid WordPress nonce token. ### Request Example ```bash curl -X GET \ 'https://example.com/wp-admin/admin-ajax.php?action=fluent_mail&route=/settings' \ -H 'Cookie: wordpress_logged_in_...=...' ``` ### Response #### Success Response (200) - **settings** (object) - Contains all Fluent SMTP settings. ``` -------------------------------- ### Get All Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves all current email settings, including provider connections and mappings. ```APIDOC ## GET /settings ### Description Returns all current settings including connections and mappings. ### Method GET ### Endpoint /settings ### Parameters #### Query Parameters - **settings** (Settings) - Required - Settings model ### Response #### Success Response (200) - **connections** (array) - Email provider connections - **mappings** (array) - Email to connection mappings - **misc** (array) - Miscellaneous settings ``` -------------------------------- ### get() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Returns paginated email logs with optional filtering and search capabilities. ```APIDOC ## GET /logs ### Description Retrieves paginated email logs. Supports filtering by status, date range, and searching within specific fields. ### Method GET ### Endpoint /logs ### Parameters #### Query Parameters - **page** (int) - Optional - Page number (default 1) - **per_page** (int) - Optional - Items per page (default 15) - **status** (string) - Optional - Filter by status: 'sent', 'failed', 'pending' - **date_range** (array) - Optional - Filter by date range in the format [start_date, end_date] - **search** (string) - Optional - Search in to/from/subject fields ### Response #### Success Response (200) - **data** (array) - Array of email log objects - **total** (int) - Total matching records - **per_page** (int) - Items per page - **current_page** (int) - Current page number - **last_page** (int) - Last page number ### Request Example ``` // GET /admin-ajax.php?action=fluent_mail&route=/logs&page=1&status=failed ``` ### Response Example ```json { "data": [ { "id": 1, "to": [{"email": "user@example.com", "name": "User"}], "from": "sender@example.com", "subject": "Hello", "status": "failed", "created_at": "2024-01-15 10:30:00" } ], "total": 45, "current_page": 1, "last_page": 3 } ``` ``` -------------------------------- ### Get Mailer Configuration Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Retrieves provider configuration. You can get all configurations, a specific provider's configuration using a dot-notation key, or a specific value with a default. ```php public function getConfig($key = null, $default = null): mixed ``` ```php $allConfig = $manager->getConfig(); $sendgridConfig = $manager->getConfig('providers.sendgrid'); $title = $manager->getConfig('providers.sendgrid.title', 'SendGrid'); ``` -------------------------------- ### Get Merged Mailer Configuration and Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Returns a combined array of all provider configurations and current settings, with settings merged into the configuration. ```php public function getMailerConfigAndSettings(): array ``` -------------------------------- ### Get FluentMail Application Instance or Service Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Use this function to get the main FluentMail application instance or a specific service/class resolved from the container. Pass the service name as a string argument. ```php function fluentMail($module = null): object ``` ```php $app = fluentMail(); $manager = fluentMail('FluentMail\App\Services\Mailer\Manager'); $settings = fluentMail('FluentMail\App\Models\Settings'); ``` -------------------------------- ### Get All Plugin Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves all current plugin settings, including connections, mappings, and miscellaneous configurations. Use this endpoint to view the entire settings state. ```json { "settings": { "connections": { "md5hash": { "title": "SendGrid", "provider_settings": { "provider": "sendgrid", "sender_email": "from@example.com", "sender_name": "Company", "api_key": "...", "force_from_name": "no", "force_from_email": "yes" } } }, "mappings": { "from@example.com": "md5hash", "other@example.com": "md5hash" }, "misc": { "log_emails": "yes", "log_saved_interval_days": "14", "default_connection": "md5hash", "fallback_connection": "" } } } ``` -------------------------------- ### Get Connection Info Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves detailed information about a specific connection. Use this to display connection configuration details. ```php public function getConnectionInfo(): mixed ``` -------------------------------- ### Implementing wp_mail_failed Consumer Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/errors.md An example of how to hook into the 'wp_mail_failed' action to log email sending failures and access error details. ```php add_action('wp_mail_failed', function($response) { error_log('Email send failed: ' . $response->get_error_message()); $data = $response->get_error_data(); // Handle failure... }); ``` -------------------------------- ### getConfig() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Retrieves provider configuration. You can get the entire configuration array or a specific value using a dot-notation key. ```APIDOC ## getConfig() ### Description Retrieves provider configuration or specific config value. ### Method getConfig ### Parameters #### Path Parameters - **key** (string) - Optional - Dot-notation path (e.g., 'providers.sendgrid') or null for all - **default** (mixed) - Optional - Default value if key not found ### Returns Configuration value or complete config array ### Example ```php $allConfig = $manager->getConfig(); $sendgridConfig = $manager->getConfig('providers.sendgrid'); $title = $manager->getConfig('providers.sendgrid.title', 'SendGrid'); ``` ``` -------------------------------- ### Get Available Notification Channels Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Returns a list of all notification channels that are available for configuration within the system. This helps in understanding the integration options. ```php public function getAvailableNotificationChannels(): array ``` -------------------------------- ### Send Test Email Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Sends a test email using the current configuration to verify setup. The request must include the recipient email address. ```php public function sendTestEmil(Request $request, Settings $settings): mixed ``` -------------------------------- ### Get Miscellaneous Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Retrieves miscellaneous settings related to email logging, retention periods, and default/fallback connections. Useful for configuring general behavior. ```php public function getMisc($settings = null): array ``` -------------------------------- ### Send Test Email Configuration Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Sends a test email to verify the current configuration. This endpoint is crucial for ensuring that the email sending setup is working correctly. ```json { "email": "test@example.com" } ``` -------------------------------- ### Initiate Telegram Connection Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Call this endpoint to start the Telegram connection process. It generates a PIN code that the user needs to send to the Telegram bot. ```json { "pin_code": "123456", "message": "Send this code to Telegram bot" } ``` -------------------------------- ### Settings::store() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Saves a new email provider connection, including validation and setup of sender mappings. It handles updates to existing connections as well. ```APIDOC ## Settings::store() ### Description Saves a new email provider connection with validation and mapping setup. ### Method ```php public function store(array $inputs): array ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **inputs** (array) - Required - Connection data ### Input Array Structure ```php { "connection_key": "existing_key_or_null", // If updating "connection": { "provider": "sendgrid", // Provider type "sender_email": "from@example.com", "sender_name": "Company Name", // ... provider-specific fields }, "valid_senders": ["from@example.com"] // Additional sender emails } ``` ### Response #### Success Response Updated full settings array ### Request Example ```php // Example usage: $newSettings = $settingsModel->store([ 'connection' => ['provider' => 'smtp', 'host' => 'smtp.example.com'], 'valid_senders' => ['test@example.com'] ]); ``` ### Response Example ```json { "connections": { ... }, "mappings": { ... }, "misc": { ... } } ``` ``` -------------------------------- ### Get WordPress Configuration Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Retrieves settings specifically from the WordPress configuration file (wp-config.php). Supports fetching all settings or a specific value using a dot-notation key. ```php public function getWPConfig($key = null, $default = null): mixed ``` -------------------------------- ### Logger add() Method Example Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Inserts a new email log entry into the database. The 'data' array must include fillable fields such as recipient, sender, subject, body, and status. Response and extra data should be serialized. ```php $logger->add([ 'to' => [['email' => 'user@example.com', 'name' => 'User']], 'from' => 'sender@example.com', 'subject' => 'Test Email', 'body' => '

Hello!

', 'status' => Logger::STATUS_SENT, 'response' => serialize(['code' => 202, 'message' => 'OK']), 'extra' => serialize(['provider' => 'sendgrid']) ]); ``` -------------------------------- ### GET / Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves dashboard statistics and an overview of email sending performance. This includes total sent and failed emails, as well as connection and sender counts. ```APIDOC ## GET / ### Description Returns dashboard statistics and overview. ### Method GET ### Endpoint /wp-admin/admin-ajax.php?action=fluent_mail&route=/ ### Parameters None ### Request Example None ### Response #### Success Response (200) - **stats** (object) - Email sending statistics. - **sent** (integer) - **failed** (integer) - **settings_stat** (object) - Sender and log settings overview. - **connection_counts** (integer) - **active_senders** (integer) - **auto_delete_days** (string) - **log_enabled** (string) #### Response Example ```json { "stats": { "sent": 1250, "failed": 15 }, "settings_stat": { "connection_counts": 2, "active_senders": 4, "auto_delete_days": "14", "log_enabled": "yes" } } ``` ``` -------------------------------- ### Build Production Frontend Assets Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/CLAUDE.md Compiles and optimizes frontend assets for production deployment. ```bash npm run prod ``` ```bash npx mix --production ``` -------------------------------- ### Get Current Settings Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/INDEX.md Retrieve the current plugin settings using the `fluentMailGetSettings()` helper function. This provides access to connection details and email mappings. ```php $settings = fluentMailGetSettings(); $connections = $settings['connections']; $mappings = $settings['mappings']; ``` -------------------------------- ### Verify an Email Provider Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/INDEX.md This snippet demonstrates how to verify if an email provider is configured and active. It uses the `Factory` to get a provider instance based on an email address and checks its active status. ```php $factory = fluentMail(\FluentMail\App\Services\Mailer\Providers\Factory::class); $provider = $factory->get('sender@example.com'); if ($provider && $provider->isActive()) { // Provider is configured and active } ``` -------------------------------- ### Create SendGrid and Mailgun Providers Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Use the `make` method to create instances of specific email provider handlers like SendGrid or Mailgun. Ensure the factory instance is available. ```php $sendgridProvider = $factory->make('SendGrid'); $mailgunProvider = $factory->make('Mailgun'); ``` -------------------------------- ### Get All Fluent SMTP Settings via cURL Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/INDEX.md Use this cURL command to retrieve all current settings for Fluent SMTP. A valid WordPress nonce and authentication are required. ```bash curl -X GET \ 'https://example.com/wp-admin/admin-ajax.php?action=fluent_mail&route=/settings' \ -H 'Cookie: wordpress_logged_in_...=...' ``` -------------------------------- ### Example Validation Error Response Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/errors.md An example JSON structure for a validation error response, indicating success status, a general message, and specific field-level errors. ```json { "success": false, "message": "Unprocessable Entity", "errors": { "api_key": "API key is required", "domain_name": "Domain name must be a valid Mailgun domain" } } ``` -------------------------------- ### POST /settings/test Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Sends a test email to verify the current configuration. ```APIDOC ## POST /settings/test ### Description Sends a test email to verify configuration. ### Method POST ### Endpoint /settings/test ### Request Body - **email** (string) - Required - The recipient email address for the test. ### Request Example ```json { "email": "test@example.com" } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Email delivered successfully." } ``` #### Error Response (422) Email validation failed or sending failed. An error message will be included. ``` -------------------------------- ### Settings::get() / Settings::getSettings() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Retrieves all plugin settings, including email provider connections, sender mappings, and miscellaneous configurations. ```APIDOC ## Settings::get() / Settings::getSettings() ### Description Retrieves all settings from WordPress options via helper function. ### Method ```php public function get(): array public function getSettings(): array ``` ### Parameters None ### Response #### Success Response Settings array with keys: - `connections` (array) - Provider connection configurations - `mappings` (array) - Email-to-connection mappings - `misc` (array) - Miscellaneous settings ### Request Example ```php // Example usage: $settings = $settingsModel->get(); ``` ### Response Example ```json { "connections": { ... }, "mappings": { ... }, "misc": { ... } } ``` ``` -------------------------------- ### Build Production JavaScript Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/README.md Compile and minify JavaScript assets for production deployment. ```bash npx mix --production ``` -------------------------------- ### GET /settings/connection_info Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves detailed information about a specific email connection. ```APIDOC ## GET /settings/connection_info ### Description Returns details about a specific connection. ### Method GET ### Endpoint /settings/connection_info ### Query Parameters - **connection_key** (string) - Required - The MD5 hash identifier of the connection. ``` -------------------------------- ### Retrieve Provider by Email Address Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Use the `get` method to retrieve a configured provider instance for a given sender email address. This method handles looking up email in connection mappings and falling back to the default provider. It applies provider settings before returning the instance. Handle potential `InvalidArgumentException` if no matching provider is found. ```php try { $provider = $factory->get('sender@example.com'); $result = $provider->send(); } catch (InvalidArgumentException $e) { // Handle no matching provider } ``` -------------------------------- ### Get Telegram Connection Info Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves the current connection information for the Telegram integration. ```APIDOC ## GET /settings/telegram/info ### Description Gets the current Telegram connection information. ### Method GET ### Endpoint /settings/telegram/info ### Response #### Success Response (200) - **token** (string) - The Telegram bot token. - **chat_id** (string) - The Telegram chat ID. - **status** (string) - The connection status. ### Response Example ```json { "token": "bot_token", "chat_id": "12345", "status": "connected" } ``` ``` -------------------------------- ### Fetch Documentation Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Fetches documentation articles from the Fluent SMTP API. ```APIDOC ## GET /admin-ajax.php?action=fluent_mail&route=/get-docs ### Description Fetches documentation from fluentsmtp.com API. ### Method GET ### Endpoint /admin-ajax.php?action=fluent_mail&route=/get-docs ### Response #### Success Response (200) - **docs** (array) - Array of documentation objects, each containing: - **title** (string) - Document title - **content** (string) - HTML content - **link** (string) - Document URL - **category** (array) - Category information ### Response Example ```json { "docs": [ { "title": "Getting Started", "content": "

Welcome to Fluent SMTP!

", "link": "https://fluentmail.com/docs/getting-started", "category": ["General"] } ] } ``` ``` -------------------------------- ### Get Email Logs Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves a paginated list of email logs, with options for filtering and searching. ```APIDOC ## GET /logs ### Description Returns paginated email logs with optional filtering. ### Method GET ### Endpoint /logs ### Query Parameters - **page** (integer) - Optional - Page number (default: 1) - **per_page** (integer) - Optional - Items per page (default: 15) - **status** (string) - Optional - Filter by status: 'sent', 'failed', 'pending' - **date_range[]** (string) - Optional - Filter by date range in YYYY-MM-DD format. Expects an array like `[start_date, end_date]`. - **search** (string) - Optional - Search term. Can be a general term or prefixed with a column name (e.g., `to:user@example.com`). ### Response #### Success Response (200) - **data** (array) - Array of log objects. - Each log object contains fields like `id`, `to`, `from`, `subject`, `body`, `status`, `response`, `extra`, `retries`, `resent_count`, `created_at`. - **total** (integer) - Total number of logs available. - **per_page** (integer) - Number of logs per page. - **current_page** (integer) - The current page number. - **last_page** (integer) - The last available page number. #### Response Example ```json { "data": [ { "id": 1, "to": [ { "email": "user@example.com", "name": "User Name" } ], "from": "sender@example.com", "subject": "Email Subject", "body": "...", "status": "sent", "response": { ... }, "extra": { ... }, "retries": 0, "resent_count": 0, "created_at": "2024-01-15 10:30:00" } ], "total": 250, "per_page": 15, "current_page": 1, "last_page": 17 } ``` #### Error Response (400) - Invalid pagination or filter parameters. ``` -------------------------------- ### Build Production Plugin Zip Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/CLAUDE.md Creates a production-ready zip archive of the plugin, excluding development files. ```bash ./build.sh ``` -------------------------------- ### Fetch Documentation Articles Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieve documentation articles from the fluentsmtp.com API. The response includes article title, content, a direct link, and category information. ```json { "docs": [ { "title": "Getting Started", "content": "...", "link": "https://fluentsmtp.com/docs/...", "category": { "value": "basics", "label": "Getting Started" } } ] } ``` -------------------------------- ### fluentMailGetProvider() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Gets the provider instance for a sender email with caching enabled. It can also force a cache refresh if needed. ```APIDOC ## fluentMailGetProvider() ### Description Gets the provider instance for a sender email with caching. ### Method ```php function fluentMailGetProvider($fromEmail, $cacheClear = false): BaseHandler|bool ``` ### Parameters #### Path Parameters - **fromEmail** (string) - Required - Sender email address - **cacheClear** (bool) - Optional - Force cache refresh ### Returns `BaseHandler` instance or false if no provider ### Details - Checks if email simulation mode is enabled - Caches provider instances per email - Returns false if no matching provider found ### Example ```php $provider = fluentMailGetProvider('sender@example.com'); if ($provider && $provider->isActive()) { $result = $provider->send(); } ``` ``` -------------------------------- ### Fetch Documentation from API Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves documentation content from the fluentsmtp.com API. The response includes document title, HTML content, URL, and category information. ```php public function getDocs(): mixed ``` -------------------------------- ### Model Constructor Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Initializes the base model with application and database objects. No parameters are required. ```php public function __construct() ``` -------------------------------- ### Get Sending Statistics for a Date Range Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves email sending statistics within a specified date range. ```APIDOC ## GET /admin-ajax.php?action=fluent_mail&route=/get-sending-stats ### Description Returns email sending statistics for a date range. ### Method GET ### Endpoint /admin-ajax.php?action=fluent_mail&route=/get-sending-stats ### Parameters #### Query Parameters - **date_range** (array) - Required - Two-element array: [start_date, end_date] (e.g., ["2023-01-01", "2023-12-31"]) ### Response #### Success Response (200) - **stats** (object) - Object containing sending statistics for the specified date range. ### Request Example ```json { "date_range": ["2023-01-01", "2023-12-31"] } ``` ``` -------------------------------- ### Mailer Manager Constructor Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Initializes the Mailer Manager service. It optionally accepts an Application instance; if none is provided, it will be auto-loaded. ```php public function __construct(?Application $app = null) ``` -------------------------------- ### Get Email Sending Statistics Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Retrieves summary statistics for all logged emails, including sent and failed counts. ```php public function getStats(): array ``` ```php $stats = $logger->getStats(); echo "Sent: " . $stats['sent'] . ", Failed: " . $stats['failed']; ``` -------------------------------- ### getSettings() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Retrieves current settings or a specific setting value using dot-notation. ```APIDOC ## getSettings() ### Description Retrieves current settings or specific setting value. ### Method getSettings ### Parameters #### Path Parameters - **key** (string) - Optional - Dot-notation path (e.g., 'misc.default_connection') - **default** (mixed) - Optional - Default value if key not found ### Returns Settings value or complete settings array ``` -------------------------------- ### Configuration Reference Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/README.md Provides a comprehensive reference for configuring FluentSMTP, including details on all supported email providers, provider-specific fields, credential storage, environment variables, global settings, and feature flags. ```APIDOC ## Configuration Reference This section details all available configuration options for FluentSMTP, enabling users to customize its behavior and integrate with various email services. ### Supported Email Providers - Reference for all 15+ supported email providers, including their default settings. - Specific configuration fields required for each provider. ### Other Configuration Options - **Credential Storage**: Options for securely storing email service credentials. - **Environment Variables**: How to use environment variables for configuration. - **Global Settings**: General plugin settings that affect its overall operation. - **Feature Flags**: Options to enable or disable specific features within FluentSMTP. - **Database Configuration**: Settings related to the plugin's database interactions. ``` -------------------------------- ### Get Dashboard Overview Statistics Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves the main dashboard statistics, including email sent/failed counts and connection information. ```APIDOC ## GET /admin-ajax.php?action=fluent_mail&route=/ ### Description Returns dashboard overview statistics including email sent/failed counts and connection info. ### Method GET ### Endpoint /admin-ajax.php?action=fluent_mail&route=/ ### Parameters #### Query Parameters - **logger** (Logger) - Required - Logger model for retrieving stats - **manager** (Manager) - Required - Mailer manager with settings ### Response #### Success Response (200) - **stats.sent** (int) - Total emails sent - **stats.failed** (int) - Total emails failed - **settings_stat.connection_counts** (int) - Number of email connections configured - **settings_stat.active_senders** (int) - Number of mapped sender emails - **settings_stat.auto_delete_days** (int) - Log retention days - **settings_stat.log_enabled** (string) - Whether email logging is enabled ### Request Example ```json { "stats": {"sent": 250, "failed": 5}, "settings_stat": { "connection_counts": 2, "active_senders": 3, "auto_delete_days": 30, "log_enabled": "yes" } } ``` ``` -------------------------------- ### Miscellaneous Settings Configuration Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/types.md Defines global plugin configuration options. Includes settings for email logging, log retention, default and fallback connections, and simulation modes. ```php $settings['misc'] = [ 'log_emails' => 'yes'|'no', 'log_saved_interval_days' => (string), 'default_connection' => (string), 'fallback_connection' => (string), 'disable_fluentcrm_logs' => 'yes'|'no', 'simulate_emails' => 'yes'|'no' ] ``` -------------------------------- ### 200 OK Success Response Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/errors.md Indicates a successful request. Typically returned for GET and POST requests that complete without errors. ```json { "success": true, "data": { ... } } ``` -------------------------------- ### setSettings() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Applies provider settings to this handler, enabling a fluent interface for configuration. ```APIDOC ## setSettings() ### Description Applies provider settings to this handler. Allows for method chaining. ### Method `setSettings(array $settings): self` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **settings** (array) - Required - Provider configuration array ### Response #### Success Response (self) Returns `self` for method chaining. #### Response Example None ### Request Example ```php $handler ->setPhpMailer($phpmailer) ->setSettings([ 'api_key' => 'xxx', 'sender_email' => 'from@example.com', 'sender_name' => 'Company' ]); ``` ``` -------------------------------- ### Get Available Notification Channels Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves a list of all available notification channel types, including their key, label, and current status. ```APIDOC ## GET /settings/notification-channels ### Description Returns available notification channel types. ### Method GET ### Endpoint /settings/notification-channels ### Response #### Success Response (200) - **key** (string) - The unique identifier for the channel (e.g., "telegram"). - **label** (string) - The human-readable name for the channel (e.g., "Telegram"). - **status** (string) - The current status of the channel ('yes' or 'no'). ### Response Example ```json [ { "key": "telegram", "label": "Telegram", "status": "no" }, { "key": "slack", "label": "Slack", "status": "yes" }, { "key": "discord", "label": "Discord", "status": "no" } ] ``` ``` -------------------------------- ### Mailer Manager Constructor Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Initializes the Mailer Manager service. It loads configuration and sets up necessary filters for email management. The application instance can be provided or auto-loaded. ```APIDOC ## Mailer Manager Constructor ### Description Initializes the manager, loads configuration, and sets up filters. ### Method __construct ### Parameters #### Path Parameters - **app** (Application) - Optional - Application instance (auto-loaded if null) ### Returns void ``` -------------------------------- ### Get Single Email Log Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves a specific email log entry along with navigation information to the next and previous entries. ```APIDOC ## GET /logs/show ### Description Returns a single log entry with navigation info. ### Method GET ### Endpoint /logs/show ### Query Parameters - **id** (integer) - Required - Log entry ID. - **filter_by** (string) - Optional - Filter column name. - **filter_by_value** (string) - Optional - Value to filter by. - **dir** (string) - Optional - Navigation direction: 'next', 'prev'. If omitted, no navigation info is returned. ### Response #### Success Response (200) - **log** (object) - The log entry object. - **next** (boolean) - Indicates if a next log entry is available. - **prev** (boolean) - Indicates if a previous log entry is available. #### Response Example ```json { "log": { ... }, "next": true, "prev": true } ``` ### Details - Returns full log entry with unserialized data. - `next`/`prev` indicate if navigation is available. ``` -------------------------------- ### get() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Retrieves the email provider handler configured for a specific sender email address. It handles lookups and fallbacks to the default provider. ```APIDOC ## get() ### Description Retrieves the provider configured for a specific sender email address. ### Method `get` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Path Parameters - **email** (string) - Yes - Sender email address ### Returns `BaseHandler` - Configured provider with settings applied ### Throws `InvalidArgumentException` if no matching provider found for email ### Details - Looks up email in connection mappings - Falls back to default provider if no mapping found - Applies provider settings before returning ### Example ```php try { $provider = $factory->get('sender@example.com'); $result = $provider->send(); } catch (InvalidArgumentException $e) { // Handle no matching provider } ``` ``` -------------------------------- ### Watch JavaScript for Development Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/README.md Use this command to continuously build JavaScript assets during development. ```bash npx mix watch ``` -------------------------------- ### SlackController Methods Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Manages Slack notification channel configuration. ```APIDOC ## SlackController Manages Slack notification channel configuration. ### Methods - **registerSite()**: Initiates OAuth registration with Slack. - **sendTestMessage()**: Sends a test notification to a Slack channel. - **disconnect()**: Removes the Slack integration. ``` -------------------------------- ### Get All Email Provider Connections Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Retrieves all configured email provider connections. This method returns a structured array of all active connections. ```php public function getConnections($settings = null): array ``` -------------------------------- ### Enable Email Simulation via Constant Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/configuration.md Alternatively, email simulation can be enabled by defining the 'FLUENTMAIL_SIMULATE_EMAILS' constant. This provides another way to control simulation behavior. ```php if (defined('FLUENTMAIL_SIMULATE_EMAILS') && FLUENTMAIL_SIMULATE_EMAILS) { // Simulate } ``` -------------------------------- ### Get Telegram Connection Info Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves the current connection status and details for the Telegram integration, including the bot token and chat ID. ```json { "token": "bot_token", "chat_id": "12345", "status": "connected" } ``` -------------------------------- ### Get Available Notification Channels Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves a list of all available notification channel types. Each channel is represented by its key, label, and current status. ```json [ { "key": "telegram", "label": "Telegram", "status": "no" }, { "key": "slack", "label": "Slack", "status": "yes" }, { "key": "discord", "label": "Discord", "status": "no" } ] ``` -------------------------------- ### getWPConfig() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Retrieves settings specifically from the WordPress configuration file (wp-config.php). Supports fetching specific values via dot-notation. ```APIDOC ## getWPConfig() ### Description Retrieves WordPress configuration file settings. ### Method getWPConfig ### Parameters #### Path Parameters - **key** (string) - Optional - Dot-notation path - **default** (mixed) - Optional - Default value ### Returns WP-Config settings value or array ``` -------------------------------- ### GET /day-time-stats Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves email sending statistics broken down by day and hour. This endpoint allows for analysis of email activity over specific periods. ```APIDOC ## GET /day-time-stats ### Description Returns email sending statistics by day and hour. ### Method GET ### Endpoint /wp-admin/admin-ajax.php?action=fluent_mail&route=/day-time-stats ### Parameters #### Query Parameters - **last_day** (integer, optional) - Number of days to analyze (0-365, default: all time) ### Request Example None ### Response #### Success Response (200) - **stats** (object) - Statistics object where keys are days of the week and values are hourly sending counts. - Example: { "Mon": { "0:00": 10, "1:00": 5, ... }, ... } #### Response Example ```json { "stats": { "Mon": { "0:00": 10, "1:00": 5, "2:00": 8, ... "23:00": 12 }, "Tue": { ... }, "Wed": { ... }, ... "Sun": { ... } } } ``` ``` -------------------------------- ### POST /settings/pushover/register Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Registers a Pushover device or user key for sending notifications. ```APIDOC ## POST /settings/pushover/register ### Description Registers a Pushover device or user key for sending notifications. ### Method POST ### Endpoint /settings/pushover/register ### Parameters #### Request Body - **user_key** (string) - Required - The Pushover user key. - **device** (string) - Optional - The name of the device to send notifications to. ``` -------------------------------- ### Sendinblue (Brevo) API Configuration Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/configuration.md Configuration for Sendinblue (now Brevo). Requires an API key and a verified sender email. ```php sender_name | '' | string | From name sender_email | '' | string | From email (must be verified) force_from_name | 'no' | string | Override From name api_key | '' | string | Sendinblue API key key_store | 'db' | string | Credential storage ``` -------------------------------- ### Get Dashboard Statistics Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieve overall email sending statistics and system settings overview. Requires 'manage_options' capability and a valid nonce. ```json { "stats": { "sent": 1250, "failed": 15 }, "settings_stat": { "connection_counts": 2, "active_senders": 4, "auto_delete_days": "14", "log_enabled": "yes" } } ``` -------------------------------- ### fluentMail() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Gets the FluentMail application instance or a bound service from the container. This is a fundamental function for accessing various parts of the Fluent SMTP application. ```APIDOC ## fluentMail() ### Description Gets the FluentMail application instance or a bound service from the container. ### Method ```php function fluentMail($module = null): object ``` ### Parameters #### Path Parameters - **module** (string) - Optional - Service/class name to resolve from container ### Returns Application instance or service instance ### Example ```php $app = fluentMail(); $manager = fluentMail('FluentMail\App\Services\Mailer\Manager'); $settings = fluentMail('FluentMail\App\Models\Settings'); ``` ``` -------------------------------- ### Get Default Email Connection Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Retrieves the default or the first configured email provider connection. Returns an empty array if no connections are set up. ```php function fluentMailDefaultConnection(): array ``` -------------------------------- ### BaseHandler Constructor Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/services.md Initializes the provider handler with an optional Application instance and Mailer Manager. ```APIDOC ## Constructor BaseHandler ### Description Initializes the provider handler. ### Method `__construct(?Application $app = null, ?Manager $manager = null)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **app** (Application) - Optional - Application instance (auto-loads) - **manager** (Manager) - Optional - Mailer manager (auto-loads) ### Response #### Success Response (void) void #### Response Example None ``` -------------------------------- ### Get Daily and Hourly Sending Statistics Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves email sending statistics grouped by day of the week and hour of the day for a specified period. ```APIDOC ## GET /admin-ajax.php?action=fluent_mail&route=/get-day-time-stats ### Description Returns email sending statistics grouped by day of week and hour of day. ### Method GET ### Endpoint /admin-ajax.php?action=fluent_mail&route=/get-day-time-stats ### Parameters #### Query Parameters - **last_day** (int) - Optional - Number of days to look back (0-365, default all time) ### Response #### Success Response (200) - **stats** (object) - Object where keys are days of the week (e.g., 'Mon') and values are objects mapping hours (e.g., '0:00') to email counts. ### Response Example ```json { "stats": { "Mon": {"0:00": 10, "1:00": 5}, "Tue": {"0:00": 8, "1:00": 12} } } ``` ``` -------------------------------- ### getMisc() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/models.md Returns miscellaneous settings. Optionally accepts a settings array, otherwise loads settings internally. ```APIDOC ## getMisc() ### Description Returns miscellaneous settings. Optionally accepts a settings array, otherwise loads settings internally. ### Method GET (conceptual) ### Endpoint (Not applicable, this is a method call) ### Parameters #### Query Parameters - **settings** (array) - Optional - Settings array (loads if null) ### Response #### Success Response - **Array with miscellaneous settings** (array) ### Response Example ```json { "log_emails": "yes", "log_saved_interval_days": "30", "default_connection": "primary", "fallback_connection": "secondary", "simulate_emails": "no" } ``` ``` -------------------------------- ### Get Connection Information Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/endpoints.md Retrieves detailed information about a specific email connection. Requires the connection's MD5 hash identifier as a query parameter. ```json { "connection_key": "md5hash" } ``` -------------------------------- ### show() Source: https://github.com/wpmanageninja/fluent-smtp/blob/master/_autodocs/api-reference/controllers.md Retrieves a single email log entry along with information about the next and previous entries. ```APIDOC ## GET /logs/{id} ### Description Retrieves a specific email log entry by its ID and provides navigation information for the next and previous entries. ### Method GET ### Endpoint /logs/{id} ### Parameters #### Path Parameters - **id** (int) - Required - The ID of the log entry to retrieve #### Query Parameters - **filter_by** (string) - Optional - Column name to filter by - **filter_by_value** (string) - Optional - Value to filter by - **dir** (string) - Optional - Navigation direction: 'next', 'prev', or null ### Response #### Success Response (200) - **log** (array) - The full email log entry details - **next** (bool) - Indicates if a next entry exists - **prev** (bool) - Indicates if a previous entry exists ```