PHP code example of skywebdev / laravel-db-mail

1. Go to this page and download the library: Download skywebdev/laravel-db-mail 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/ */

    

skywebdev / laravel-db-mail example snippets




namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class TestMail extends Mailable
{
    use Queueable, SerializesModels;

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

    /**
     * Get the message envelope.
     *
     * @return \Illuminate\Mail\Mailables\Envelope
     */
    public function envelope()
    {
        return new Envelope(
            subject: 'Test Mail',
        );
    }

    /**
     * Get the message content definition.
     *
     * @return \Illuminate\Mail\Mailables\Content
     */
    public function content()
    {
        return new Content(
            markdown: 'test_mail',
        );
    }

    /**
     * Get the attachments for the message.
     *
     * @return array
     */
    public function attachments()
    {
        return [];
    }
}



use Illuminate\Support\Facades\Route;

Route::get('/mail', function () {
    return (new \App\Mail\TestMail());
});
bash
php artisan migrate
bash
php artisan db:seed --class="SkyWebDev\Database\Seeders\AddBladeTemplatesSeeder"
bash
php artisan make:mail TestMail --markdown=test_mail
 resource/views/test_mail.blade.php 
 routes.web.php 
bash
php artisan db:seed --class="SkyWebDev\Database\Seeders\AddBladeTemplatesSeeder"
bash
php artisan view:clear