Files
bookstore/wp-content/mu-plugins/local-mail-catcher.php
T
twooeyandClaude Sonnet 5 c9d637c907 Week 1 infrastructure: Docker environments, deploy pipeline, bookstore-core scaffold
Docker Compose environments for dev/staging/production (MariaDB, Redis,
Caddy, Action Scheduler cron sidecar), an idempotent deploy script,
git-hook-based deploy pipeline, backup/restore scripts, and the
bookstore-core plugin stub with WooCommerce HPOS compatibility declared.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-27 09:50:18 -04:00

23 lines
668 B
PHP

<?php
/**
* Route outgoing mail to a local catcher outside production, so no test
* email ever reaches a real customer (design doc §01/§08).
*
* Same code in every environment — the only thing that changes is the
* WP_ENVIRONMENT_TYPE define set per-environment in docker-compose.
*/
defined('ABSPATH') || exit;
if (wp_get_environment_type() === 'production') {
return;
}
add_action('phpmailer_init', function ($phpmailer) {
$phpmailer->isSMTP();
$phpmailer->Host = getenv('MAIL_CATCHER_HOST') ?: 'mailhog';
$phpmailer->Port = getenv('MAIL_CATCHER_PORT') ?: 1025;
$phpmailer->SMTPAuth = false;
$phpmailer->SMTPAutoTLS = false;
});