PHP code example of modernmcguire / mailspy

1. Go to this page and download the library: Download modernmcguire/mailspy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

modernmcguire / mailspy example snippets


use ModernMcGuire\MailSpy\Facades\MailSpy;
use \Illuminate\Mail\Events\MessageSending;
use \Illuminate\Mail\Events\MessageSent;

MailSpy::sending(function (MessageSending $event, Email $email) {
    // Do something with the event
});

MailSpy::sent(function (MessageSent $event, Email $email) {
    // Do something with the event
});

use ModernMcGuire\MailSpy\Facades\MailSpy;
use ModernMcGuire\MailSpy\Traits\MailspyTags;

class MarketingPlan extends Mailable implements ShouldQueue
{
    use Queueable;
    use SerializesModels;
    use MailspyTags;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(
        public Client $client,
    ) {
        //
    }


    public function tags(): array
    {
        return [
            'client' => $this->client->id,
        ];
    }

}

bash
php artisan vendor:publish --tag="mailspy-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="mailspy-config"