$result,'to'=>$to,'subject'=>$subject,'smtp_host'=>defined('SMTP_HOST')?SMTP_HOST:(ini_get('SMTP')?:null)]; } public static function getEmailConfig(array $args): array { return [ 'admin_email' => get_option('admin_email'), 'from_name' => get_option('blogname'), 'smtp_host' => defined('SMTP_HOST') ? SMTP_HOST : (ini_get('SMTP') ?: 'php mail()'), 'smtp_port' => defined('SMTP_PORT') ? SMTP_PORT : ini_get('smtp_port'), 'phpmailer' => class_exists('PHPMailer\\PHPMailer\\PHPMailer') ? 'available' : 'not found', 'wp_mail_smtp' => is_plugin_active('wp-mail-smtp/wp_mail_smtp.php') ? 'active' : 'inactive', ]; } public static function listEmailLog(array $args): array { // Works with WP Mail SMTP log or generic fallback $per_page = (int)($args['per_page'] ?? 20); global $wpdb; // Try WP Mail SMTP log table $table = $wpdb->prefix . 'wpms_logs'; if ($wpdb->get_var("SHOW TABLES LIKE '$table'")) { $rows = $wpdb->get_results($wpdb->prepare( "SELECT id, subject, people, status, date_sent FROM $table ORDER BY id DESC LIMIT %d", $per_page ), ARRAY_A); return ['source'=>'wp-mail-smtp','logs'=>$rows,'count'=>count($rows)]; } return ['source'=>'none','message'=>'No email log plugin detected. Install WP Mail SMTP for logging.','logs'=>[]]; } }