PHP code example of yozaz / laravel-swiftmailer

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

    

yozaz / laravel-swiftmailer example snippets


'YOzaz\LaravelSwiftmailer\ServiceProvider',

'Mail' => 'YOzaz\LaravelSwiftmailer\Facade',

// disable auto reset
Mailer::disableAutoReset();
// enable it back
Mailer::enableAutoReset();
// Set my status
Mailer::setAutoReset(true);
// check if auto-reset is enabled
if ( Mailer::autoResetEnabled() ) { ...

// send only STOP after every email
Mailer::setModeStop();
// send only RESET before every email
Mailer::setModeReset();
// aggressive mode - STOP and RESET (default)
Mailer::setModeBoth();

Mailer::reset()->send(...);
Mailer::stop();

Mailer::setSilent(true);

var $mailer = App::make('laravel-swiftmailer.mailer');

var $mailer = new \YOzaz\LaravelSwiftmailer\Mailer();

var $my_custom_mailer = App::make('mailer');
// pass custom mailer and disable auto-reset
var $mailer = new \YOzaz\LaravelSwiftmailer\Mailer( $my_custom_mailer, false );

Mailer::setMailer( $my_custom_mailer );