PHP code example of filippo-toso / mailable

1. Go to this page and download the library: Download filippo-toso/mailable 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/ */

    

filippo-toso / mailable example snippets




namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\SerializesModels;
use FilippoToso\Mailable\Mailable;

class CustomerPurchase extends Mailable
{
    use Queueable, SerializesModels;

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

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('view.name');
    }
}


$mail = (new CustomerPurchase)->configure([
    'transport' => 'smtp',
    'host' => 'smtp.mailgun.org',
    'port' => 587,
    'encryption' => 'tls',
    'username' => 'username',
    'password' => 'password',
    'timeout' => null,
    'auth_mode' => null,
]);

Mail::to('[email protected]')->queue($mail);

$mail = new CustomerPurchase();

$mail->configure([
    'transport' => 'smtp',
    'host' => 'smtp.mailgun.org',
    'port' => 587,
    'encryption' => 'tls',
    'username' => 'username',
    'password' => 'password',
    'timeout' => null,
    'auth_mode' => null,
]);

Mail::to('[email protected]')->queue($mail);



namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Mail\Mailable;
use FilippoToso\Mailable\Traits\MailableTrait;

class CustomerPurchase extends Mailable
{
    use Queueable, SerializesModels, MailableTrait;

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

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('view.name');
    }
}