Skip to content

weew/app-swift-mailer

Repository files navigation

App SwiftMailer provider

Build Status Code Quality Test Coverage Version Licence

Table of contents

Installation

composer require weew/app-swift-mailer

Introduction

This package integrates the swiftmailer/swiftmailer library into the weew/app package.

Usage

To make SwiftMailer available inside your application, simply register SwiftMailerProvider on the kernel.

$app->getKernel()->addProviders([
    SwiftMailerProvider::class
]);

You can retrieve a specific mailer by config name like this:

$swiftMailerManager = $app->getContainer()->get(ISwiftMailerManager::class);

// returns the default mailer
$swiftMailerManager->getMailer();

// returns a mailer using the specific config
$swiftMailerManager->getMailer('config1');

Example config

Currently supported transports are null, sendmail, smtp. This is how your configuration might look like:

swift_mailer:
  transports:
    # this is the default transport that is used in case no
    # mailer config name has been specified
    default: "{swift_mailer.transports.config2}"

    config1:
      type: smtp
      # server settings
      host: localhost
      port: 25
      security: tls
      # server username and password
      username:
      password:

    config2:
      type: sendmail
      # override for the used sendmail command
      command:

About

Integration of the swiftmailer/swiftmailer into the weew/app package.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages