weew/app-swift-mailer

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

v1.1.1 2016-07-21 11:17 UTC

This package is not auto-updated.

Last update: 2024-12-17 22:56:38 UTC


README

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: