everlutionsk/mandrill-bundle

Everlution mandrill bundle for Symfony framework

Installs: 3 591

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 9

Forks: 2

Open Issues: 0

Type:everlution-bundle

v1.3.0 2019-01-04 10:11 UTC

This package is auto-updated.

Last update: 2024-12-04 22:52:23 UTC


README

This Symfony bundle provides mail system and request processors for Email Bundle. Bundle use Mandrill transactional email platform.

Installation

composer require everlutionsk/mandrill-bundle

Enable the bundle

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Everlution\MandrillBundle\EverlutionMandrillBundle()
    );
}

Configure the bundle

Following configuration snippet describes how to configure the bundle.

Firstly, you must modify EmailBundle configuration to work with MandrillBundle's services.

# app/config/config.yml

# EmailBundle Configuration
everlution_email:
    mail_system: everlution.mandrill.mail_system
    request_processors:
        inbound: everlution.mandrill.inbound.request_processor
        outbound_message_event: everlution.mandrill.outbound.message_event.request_processor

Secondly, you must configure MandrillBundle itself

# app/config/config.yml

# MandrillBundle Configuration
everlution_mandrill:
    api_key: SECRET_API_KEY
    async_mandrill_sending: true
    enforced_delivery_address: EMAIL_ADDRESS|NULL

async_mandrill_sending - If it is true, then Mandrill use a background sending mode that is optimized for bulk sending. In async mode, Mandrill will immediately return a status of "queued" for every message. This is a recommended setting, because bundle is able to handle message events, which describe message state, later and fully automatically.

enforced_delivery_address - [Optional] Email address, which will be used to override recipient address in every outbound message. Changes are fully transparent and data stored in database is not affected by this transformation. Warning: Mail system ID could be associated with wrong recipient due to Mandrill API limitations. This limitation could lead to incorrect 'outbound message event' handling.

Usage

Message transformers

Mail system service provided by this bundle transform OutboundMessage into JSON and then POST this JSON to Mandrill API. However, this JSON can be modified just before it is posted to Mandrill. To do this you must create a service, which implements RawMessageTransformer interface and add following tag:

everlution.mandrill.outbound.raw_message_transformer

TODO

  • Request signature calculation
  • Webhook keys configuration