2017 © Pedro Peláez
 

symfony-bundle email-bundle

Email Bundle for Symfony

image

libre-informatique/email-bundle

Email Bundle for Symfony

  • Friday, March 16, 2018
  • by beta
  • Repository
  • 6 Watchers
  • 1 Stars
  • 2,584 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 15 Versions
  • 0 % Grown

The README.md

SymfonyLibrinfoEmailBundle

Travis [Coveralls][coveralls] License, (*1)

Latest Stable Version Latest Unstable Version Total Downloads, (*2)

About

The Libre Informatique EmailBundle leverages Swiftmailer and the Libre Informatique CoreBundle to provide seemless email and newsletter functionalities. Features include database spooling, configurable spool flush command, email openings and link clicks tracking along with stats display, inline attachments, templating, duplication, ..., (*3)

Installation

$ composer require libre-informatique/email-bundle, (*4)

// app/AppKernel.php
// ...
public function registerBundles()
{
    $bundles = array(
        // ...

        // the libre-informatique bundles
        new Librinfo\EmailBundle\LibrinfoEmailBundle(),

        // your personal bundles
        // ...
    );
}

Configuration

Dependencies

    // app/AppKernel.php
    // ...
    public function registerBundles()
    {
        $bundles = array(
            // ...

            // Sonata
            new Sonata\CoreBundle\SonataCoreBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),
            new Sonata\IntlBundle\SonataIntlBundle(),

            // Blast
            new Blast\OuterExtensionBundle\BlastOuterExtensionBundle(),
            new Blast\CoreBundle\BlastCoreBundle(),
            new lbr\BlastTestBundle\BlastTestBundle(),
            new Blast\BaseEntitiesBundle\BlastBaseEntitiesBundle(),
            new Blast\UtilsBundle\BlastUtilsBundle(),

            // Attachments
            new Librinfo\MediaBundle\LibrinfoMediaBundle(), 

            // Wisiwig editor
            new Stfalcon\Bundle\TinymceBundle\StfalconTinymceBundle(),

            // your personal bundles
            // ...
        );
    }
    // ...
# app/config/routing.yml
admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /

blast_core:
    resource: "@BlastCoreBundle/Resources/config/routing.yml" 
    prefix:   /admin

email:
    resource: "@LibrinfoEmailBundle/Resources/config/routing.yml"
    prefix: /admin
# app/config/config.yml
sonata_block:
    default_contexts: [cms]
    blocks:
        # Enable the SonataAdminBundle block
        sonata.admin.block.admin_list:
            contexts:   [admin]
        # Your other blocks

But please, refer to the source doc to get up-to-date : https://sonata-project.org/bundles/admin/2-3/doc/reference/installation.html, (*5)

Just notice that the prefix value is / instead of /admin as advised by the Sonata Project... By the way, it means that this access is universal, and not a specific "backend" interface. That's a specificity of a software package that intends to be focused on professional workflows., (*6)

Don't forget to publish assets as some features of the bundle such as file upload rely heavily on javascript., (*7)

Add the custom form field template to your config.yml:, (*8)

# app/config/config.yml
twig:
    debug: '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    form_themes:
        - 'SonataCoreBundle:Form:datepicker.html.twig'
        - 'SonataCoreBundle:Form:colorpicker.html.twig'
        - 'BlastCoreBundle:Admin/Form:fields.html.twig'
        - 'BlastUtilsBundle:Form:fields.html.twig'
        - 'BlastBaseEntitiesBundle:Form:fields.html.twig'
        - 'LibrinfoMediaBundle:Form:fields.html.twig'

Spooling

You have to configure two mailers as follows in order to use the database spooling feature (one for direct sned, the other for spool send), (*9)

# app/config/config.yml

swiftmailer:
    default_mailer: direct_mailer
    mailers:
        direct_mailer:
            transport: "%mailer_transport%"
            host:      "%mailer_host%"
            username:  "%mailer_user%"
            password:  "%mailer_password%"
        spool_mailer:
            transport: "%mailer_transport%"
            host:      "%mailer_host%"
            username:  "%mailer_user%"
            password:  "%mailer_password%"
            spool: { type: db }

To flush the queue execute the command : $ app/console librinfo:spool:send, (*10)

Don't hesitate executing the command with --help as it has more options than the swiftmailer:spool:send, (*11)

Tracking

If you want to use the tracking functionalities, you need to add an access control rule to your security.yml that will allow anonymous users to access routes with the prefix '/tracking' like so:, (*12)

# app/config/security.yml
access_control:
        # ...
        - { path: ^/tracking, role: IS_AUTHENTICATED_ANONYMOUSLY } # allow access to tracking controller for anonymous users

That's it !, (*13)

The Versions