This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
FluentSMTP is a WordPress SMTP plugin that connects WordPress with various email service providers. It provides native integrations with 15+ email services, email routing, logging, and detailed reporting. The plugin uses a modern stack with VueJS 2 frontend and PHP backend following WordPress plugin architecture.
# Install dependencies
npm install
# Development mode with watch
npm run start
# or
npx mix watch
# Production build
npm run prod
# or
npx mix --production# Install PHP dependencies
composer install
# Static analysis
vendor/bin/phpstan analyse# Build production-ready plugin zip
./build.shThe build script:
- Builds frontend assets with production optimization
- Installs composer dependencies with
--no-dev --classmap-authoritative - Creates
fluent-smtp.zipexcluding dev files - Restores dev dependencies
Namespace Convention:
FluentMail\App\→app/directory (application logic)FluentMail\Includes\→includes/directory (framework components)
Key Directories:
-
app/Http/- Controllers, routes, and policiesroutes.php- All AJAX endpoint definitionsControllers/- Handle HTTP requestsPolicies/- Authorization logic
-
app/Services/- Business logic servicesMailer/Providers/- Email provider integrations (SendGrid, Mailgun, Gmail, etc.)Mailer/BaseHandler.php- Base class for all email handlersNotification/- Notification channels (Telegram, Slack, Discord)DB/- Database query builders and models
-
app/Models/- Database models (Settings, Logger) -
app/Hooks/- WordPress action/filter handlers -
includes/Core/- Framework foundationApplication.php- Main application containerContainer.php- Dependency injection container
-
includes/Support/- Helper classes and utilities -
database/- Database migrationsFluentMailDBMigrator.php- Migration runnermigrations/- Individual migration files
Location: resources/admin/
Tech Stack:
- Vue.js 2
- Vue Router
- Element UI component library
- Chart.js for analytics
Entry Points:
boot.js→ Compiled toassets/admin/js/boot.jsstart.js→ Compiled toassets/admin/js/fluent-mail-admin-app.jsroutes.js- Frontend routing configuration
Key Directories:
Modules/- Feature modules (dashboard, settings, logs)Bits/- Reusable Vue componentsPieces/- Shared UI pieces
Build Output: assets/admin/
fluent-smtp.php- Main plugin file, defines constants, overrideswp_mail()boot.php- Defines constants and loads autoloaderincludes/Core/Application.php- Bootstraps application, registers hooks- Action hook
fluentMail_loadedfires with application instance
Important: The plugin forces itself to load first among all plugins to override wp_mail() function before other plugins.
All email providers extend BaseHandler in app/Services/Mailer/BaseHandler.php and implement:
send()method for sending emails- Connection validation
- Settings schema
Providers located in: app/Services/Mailer/Providers/
Each provider folder contains:
Handler.php- Main implementationSettings.php- Settings UI configuration
Uses custom DB abstraction layer in app/Services/DB/ instead of WordPress $wpdb for query building.
Table prefix: fsmpt_ (defined as FLUENT_MAIL_DB_PREFIX)
Defined in boot.php:
FLUENTMAIL- Plugin slugFLUENTMAIL_PLUGIN_VERSION- Current versionFLUENTMAIL_UPLOAD_DIR- Upload directory pathFLUENT_MAIL_DB_PREFIX- Database table prefixFLUENTMAIL_PLUGIN_URL- Plugin URLFLUENTMAIL_PLUGIN_PATH- Plugin directory path
- Create folder in
app/Services/Mailer/Providers/[ProviderName]/ - Implement
Handler.phpextendingBaseHandler - Implement
Settings.phpfor admin UI configuration - Register in
app/Services/Mailer/Providers/Factory.php - Add configuration in
app/Services/Mailer/Providers/config.php
- Add route in
app/Http/routes.php - Create or update controller in
app/Http/Controllers/ - Frontend calls via AJAX to WordPress admin-ajax.php
- Create component in
resources/admin/Bits/(reusable) orresources/admin/Modules/(feature-specific) - Import and register in parent component or routes
- Run
npm run startto watch changes
Currently no automated test suite. PHPStan configured at level 0 for static analysis.
PHP:
- Google API Client in
includes/libs/google-api-client/(excluded from autoload)
JavaScript:
- Element UI for components
- Chart.js for analytics
- Day.js for date handling
- Lodash for utilities
- Email routing logic allows multiple email providers with fallback support
- Email logging stores all outbound emails for debugging/resending
- OAuth2 implementation in
includes/OAuth2Provider.phpfor Gmail/Outlook - Translation strings extracted to
app/Services/TransStrings.php - Assets built with Laravel Mix (webpack wrapper)