PHP code example of wedevelop4you / laravel-multiple-mailers

1. Go to this page and download the library: Download wedevelop4you/laravel-multiple-mailers 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/ */

    

wedevelop4you / laravel-multiple-mailers example snippets


    /*
     *  'Choose a name for your mail config' => [
     *	    'username' => 'Your email address', ( email' (The default name is MAIL_FROM_NAME in your .env file)
     * 	    'provider' => 'Your provider' (The default provider is default)
     *  ]
     */
    'accounts' => [
        'example' => [
            'username' => '[email protected]',
            'password' => env('MAIL_PASSWORD'),
        ]
    ]

    /*
     *	The providers are the same as mailers in the mail config
     */
    'provider' => [
        'default' => [
            'transport' => 'smtp',
            'host' => env('MAIL_HOST'),
            'port' => env('MAIL_PORT'),
            'encryption' => env('MAIL_ENCRYPTION'),
            'timeout' => null,
            'auth_mode' => null,
        ],
    ]

     /*
     *  'worker' => The name of the queue worker. (The default name of the worker is 'default')
     *  'default' => Always use the queue worker name on mail classes with ShouldQueue.
     */
    'queue' => [
        'worker' => '',
        'default' => false,
    ]

Mail::mailer('example');

Mail::mailer('example')->to('[email protected]')->send(new ExampleMail());

use Queueable, SerializesModels, MultipleMailer;

$this->setMultipleMailerName('example');

    public function __construct()
    {
        $this->setMultipleMailerName('example');
    }

php artisan vendor:publish --provider="WeDevelop4You\LaravelMultipleMailers\Providers\MailerServiceProvider" --tag=config