• Resources
  • Local extender to disable sending mail

I had this one lingering in my development installation.

Make sure you configure your composer.json so that the App\\ namespace resolves with PSR-4 to the app\ directory:


        "autoload": {
            "psr-4": {
                "App\\": "app/"
            }
        },

Then create app/Extend/MailBin.php:

<?php

namespace App\Extend;

use App\Mail\ArrayDriver;
use Flarum\Extend\ExtenderInterface;
use Flarum\Extension\Extension;
use Illuminate\Contracts\Container\Container;

class MailBin implements ExtenderInterface
{
    public function extend(Container $container, Extension $extension = null)
    {
        $container->extend('mail.supported_drivers', function () {
            return [
                'array' => ArrayDriver::class
            ];
        });
    }
}

This removes all registered mail drivers and registers the driver that doesn't do a thing.

In extend.php:

return [
    new App\Extend\MailBin,
];