lopatin96 / laravel-mail
Laravel mail
Installs: 5 680
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- lopatin96/laravel-nova-badges: ^1.0
Requires (Dev)
- orchestra/testbench: ^8.0
README
Migrations
php artisan vendor:publish --tag="laravel-mail-migrations"
then run php artisan migrate
Listeners
Register an event listener in App\Providers\EventServiceProvider:
use Atin\LaravelMail\Listeners\LogSentMessage; use Illuminate\Mail\Events\MessageSent; /** * The event listener mappings for the application. * * @var array */ protected $listen = [ MessageSent::class => [ LogSentMessage::class, ], ];
Generating Mailables
New "mailable" class will be stored in the app/Mail directory.
php artisan make:mail OrderShipped
Mailable class
Extend from Atin\LaravelMail\Mail\Mailable
to log.
use Atin\LaravelMail\Mail\Mailable; class UserConfirmEmail extends Mailable { public function build() { // Build email } }
Trait
Add HasMailLogs
trait.
use Atin\LaravelMail\Traits\HasMailLogs; class User extends Authenticatable { use HasMailLogs; … }
Migrations
php artisan vendor:publish --tag="laravel-mail-migrations"