/** * Register the application services. */ public function register() { parent::register(); $this->app->singleton('mailer', function ($app) { $this->registerSwiftMailer(); // Once we have create the mailer instance, we will set a container instance // on the mailer. This allows us to resolve mailer classes via containers // for maximum testability on said classes instead of passing Closures. $mailer = new Utils\Mailer($app['view'], $app['swift.mailer'], $app['events']); $this->setMailerDependencies($mailer, $app); // If a "from" address is set, we will set it on the mailer so that all mail // messages sent by the applications will utilize the same "from" address // on each one, which makes the developer's life a lot more convenient. $from = $app->config['mail.from']; if (is_array($from) && isset($from['address'])) { $mailer->alwaysFrom($from['address'], $from['name']); } $to = $app->config['mail.to']; if (is_array($to) && isset($to['address'])) { $mailer->alwaysTo($to['address'], $to['name']); } // Here we will determine if the mailer should be in "pretend" mode for this // environment, which will simply write out e-mail to the logs instead of // sending it over the web, which is useful for local dev environments. $pretend = $app->config->get('mail.pretend', false); $mailer->pretend($pretend); return $mailer; }); }
public function register() { $config_path = __DIR__ . '/../../config/desmart-laravel-mailer.php'; $this->publishes([$config_path => config_path('desmart-laravel-mailer.php')], 'config'); $this->mergeConfigFrom($config_path, 'desmart-laravel-mailer'); if (true === $this->app['config']->get('desmart-laravel-mailer.enabled')) { $this->registerMailer(); } else { parent::register(); } }
public function register() { $this->app['config']->package('govdelivery/tms-mail-transport', realpath(__DIR__ . '/config')); $this->app->bind('tms.client', function ($app) { $key = $app['config']->get('tms-mail-transport::config.authkey', ''); $api_root = $app['config']->get('tms-mail-transport::config.api_root', 'https://tms.govdelivery.com'); return new Client($key, $api_root); }); $this->app->bind('tms.email', function ($app) { $email = new Email($app['tms.client']); $email->build(['from_name' => $app['config']->get('mail.from')['name'], 'from_email' => $app['config']->get('mail.from')['address'], 'click_tracking_enabled' => $app['config']->get('tms-mail-transport::config.click_tracking_enabled', false), 'open_tracking_enabled' => $app['config']->get('tms-mail-transport::config.open_tracking_enabled', false)]); return $email; }); parent::register(); }
/** * Register any package services. * * @return void */ public function register() { parent::register(); $this->mergeConfigFrom(__DIR__ . '/../config/mailman.php', 'mailman'); }
public function register() { parent::register(); $this->app->register(SendgridTransportServiceProvider::class); }