2017 © Pedro Peláez
 

symfony-bundle swiftmailer-sparkpost-bundle

Swiftmailer Sparkpost transport as a Symfony bundle

image

g1ntas/swiftmailer-sparkpost-bundle

Swiftmailer Sparkpost transport as a Symfony bundle

  • Thursday, February 15, 2018
  • by gintko
  • Repository
  • 1 Watchers
  • 1 Stars
  • 713 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 39 % Grown

The README.md

Swiftmailer Sparkpost bundle

Build Status, (*1)

This bundle adds an extra transport to the Swiftmailer service that uses Sparkpost API. Internally this bundle integrates f500/swiftmailer-sparkpost to your Symfony Project., (*2)

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*3)

$ composer require g1ntas/swiftmailer-sparkpost-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*4)

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*5)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Gintko\Swiftmailer\SparkpostBundle\GintkoSwiftmailerSparkpostBundle(),
        );

        // ...
    }

    // ...
}

Step 3: Configure the Bundle

Configure Sparkpost by adding API key in the app/config/config.yml configuration file:, (*6)

# app/config/config.yml
# ...

gintko_swiftmailer_sparkpost:
    api_key: 'SparkPostApiKey'

Also configure Swiftmailer to use Sparkpost transport:, (*7)

# app/config/config.yml
# ...

swiftmailer:
    transport: sparkpost
    # ...

Usage

<?php
// ...

public function sendEmailAction() 
{
    $mailer = $this->get('mailer');

    $message = $mailer->createMessage()
        ->setSubject('test')
        ->setFrom('me@domain.com', 'Me')
        ->setTo(['john@doe.com' => 'John Doe', 'jane@doe.com'])
        ->setSubject('...')
        ->setBody('...');

    $mailer->send($message);
}

Specialized messages

<?php
// ...

public function sendEmailAction() 
{

    $mailer = $this->get('mailer');

    $message = $mailer->createMessage('sparkpost')
        ->setFrom('me@domain.com', 'Me')
        ->setTo(['john@doe.com' => 'John Doe', 'jane@doe.com'])
        ->setSubject('...')
        ->setBody('...')

        ->setCampaignId('...')
        ->setPerRecipientTags('john@doe.com', ['...'])
        ->setMetadata(['...' => '...'])
        ->setPerRecipientMetadata('john@doe.com', ['...' => '...'])
        ->setSubstitutionData(['...' => '...'])
        ->setPerRecipientSubstitutionData('john@doe.com', ['...' => '...'])
        ->setOptions(['...']);

    $mailer->send($message);
}

Configuration

All below specified values are default., (*8)

gintko_swiftmailer_sparkpost:
    api_key: 'SparkPostApiKey' # required
    ip_pool_probability: 1.0
    recipient_override:
        email: null
        gmail_style: false
    message_options:
        transactional: true
        open_tracking: false
        click_tracking: false
        sandbox: false
        skip_suppression: false
        inline_css: false
        ip_pool: null

These options will be applied to all messages, but if you need you can provide custom configuration for each message. More about that read in original package page., (*9)

The Versions

15/02 2018

dev-master

9999999-dev https://github.com/g1ntas/swiftmailer-sparkpost-bundle

Swiftmailer Sparkpost transport as a Symfony bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Gintas Kovalevskis

email swiftmailer bundle symfony mailer sparkpost

10/10 2017

v1.0.1

1.0.1.0 https://github.com/g1ntas/swiftmailer-sparkpost-bundle

Swiftmailer Sparkpost transport as a Symfony bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Gintas Kovalevskis

email swiftmailer bundle symfony mailer sparkpost

20/06 2017

v1.0

1.0.0.0 https://github.com/g1ntas/swiftmailer-sparkpost-bundle

Swiftmailer Sparkpost transport as a Symfony bundle

  Sources   Download

MIT

The Requires

 

The Development Requires

by Gintas Kovalevskis

email swiftmailer bundle symfony mailer sparkpost