Developed with love by KnpLabs Hire us for your project!
49

WowoNewsletterBundle

by wowo

Newsletter Bundle for Symfony2 (with messages queuing in beanstalkd)

WowoNewsletterBundle

Build Status

The WowoNewsletterBundle provides easy way to send huge amount of rich HTML
e-mails. It uses beanstalkd queue broker to handle mails before they will be
sent. Bundle is highy extendable - you can provide your own source of contacts
or use default one, provided with bundle.

Features included:
- Sending HTML e-mails (with embed rich content)
- Customizable contacts source
- High performance (beanstalkd offfers several thousand operations per second)
- Personalizable messages - you can define as many placeholders as you wish
- Scalable-ready - you can put beanstalkd queue and worker which sends mails
away from your main application webserver

This bundle depends on WowoQueueBundle, which is abstraction layer for beanstalkd messaging system

Installation

Step 1: Download WowoNewsletterBundle

composer mechanism

Add following lines to your composer.json "require" definitions:

"wowo/wowo-newsletter-bundle": "dev-master"

Now, run the composer script to download the bundle:

$ php composer.phar install

deps mechanism

Add following lines to your deps file:

    [WowoNewsletterBundle]
        git=git://github.com/wowo/WowoNewsletterBundle.git
        target=bundles/Wowo/NewsletterBundle

    [WowoQueueBundle]
        git=git://github.com/wowo/WowoQueueBundle.git
        target=bundles/Wowo/QueueBundle

and after check for other dependences and its settings at https://github.com/wowo/WowoQueueBundle, run the vendors script to download the bundle:

$ php bin/vendors install

Step 2: Configure the Autoloader (skip it if you are using composer)

Add the Wowo namespace to your autoloader:

<?php
// app/autoload.php

$loader->registerNamespaces(array(
    // ...
        'Wowo' => __DIR__.'/../vendor/bundles',
        ));

Step 3: Enable the bundle

Finally, enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
        $bundles = array(
            // ...
            new Wowo\NewsletterBundle\WowoNewsletterBundle(),
        );
}

Step 4: run newsletter:send worker

Last thing you need to do, to achieve mailings sending is to run worker:

$ php app/console newsletter:send

There's optional switch --verbose which can be useful as a simple stdout monitor

TinyMCE integration

This bundle is TinyMCE-ready. Just turn on this bundle and add some config (example is below) and body field will transform into Rich Text editor.

stfalcon_tinymce:
    include_jquery: true
    theme:
        advanced:
            mode: "textareas"
            theme: "advanced"
            theme_advanced_buttons1: "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,link,unlink"
            theme_advanced_buttons2: ""
            theme_advanced_buttons3: ""
            theme_advanced_toolbar_location: "top"

Configuration

You can set plenty of parameters, which can be found in services.xml. Also you can
adjust some options in app/config/config.yml (mapping and templates)

Parameters:

  • wowo_newsletter.queue (default: newsletter_tube) - Beanstalkd tube name
  • wowo_newsletter.default.sender_name (default: Wojciech Sznapka) - "from" name in email messages
  • wowo_newsletter.default.sender_email (default: wojciech@sznapka.pl) - "from" address in email messages
  • wowo_newsletter.form.can.choose.contacts.via.form (default: true) - determines if contacts can be choosen using form
  • wowo_newsletter.form.has.delayed.sending (default: true) - determines wheter form allows to delay mailing (setting send date)

Configuration (config.yml)

Example:
yml
wowo_newsletter:
placeholders:
key1: value1
key2: value3
key3: value3
name: getName
email: getEmail
templates:
'template name': %kernel.root_dir%/Resources/mailing/mailing.html

In placeholders you should provide map, in which key is placeholder name (example: email) and value is property/getter name on contact entity.
There are two obligatory keys: (email and name).

With templates you can set html templates (with images relative to its dir) source. By default it takes first position ('template name' in above) and resolves filesystem path for HTML template and images. You can add your own implementation, so user can choose from configured templates or even add his own (stored in database).

Extension and adjustments guidelines

You can extend bundle by providing your own contact source. There are more extension points, but this one is most probably to use.

parameters:
    wowo_newsletter.contact_manager.class: Your\Bundle\NewsletterContactManager
    wowo_newsletter.model.contact.class: Your\Bundle\Entity\User

wowo_newsletter:
    placeholders:
        firstname:  getFirstname
        lastname:   getLastname
        email:      getEmail
    templates:
        'main template': %kernel.root_dir%/Resources/templates/newsletter/mailing.html

In above example User is an existing Entity, which has fields firstname, lastname, email. For this purposes we wrote NewsletterContactManager which implements Wowo\NewsletterBundle\Newsletter\Model\ContactManagerInterface and provides bundle with contacts retrieved by Doctrine2.

tracking

wowo_newsletter:
placeholders:

# Defaults:
name: getFullName
email: getEmail
templates: []
  • Merge pull request #22 from bghosts/feature/dutch-translation
    By web-flow, 25 days ago
  • adds dutch translation
    By bghosts, 26 days ago
  • Added typegintings for objects passed to methods
    By Wojciech Sznapka, 7 years ago
  • Specified licence in composer.json
    By Wojciech Sznapka, 7 years ago
  • Ran php-cs-fixer and removed unused 'uses'
    By Wojciech Sznapka, 7 years ago
  • Removed execute permission from text file
    By Wojciech Sznapka, 7 years ago
  • Merge branch 'master' of github.com:wowo/WowoNewsletterBundle
    By Wojciech Sznapka, 7 years ago
  • Removed top limitation for symfony components (<=2.2)
    By Wojciech Sznapka, 7 years ago
  • Merge pull request #20 from emgiezet/master
    By wowo, 7 years ago
  • Little fix to integrate the bunlde with SonataAdminBunle + documentation for Mailing entity
    By emgiezet, 7 years ago
  • Added coveralls config
    By Wojciech Sznapka, 7 years ago
  • Added wildcard in queue bundle (composer)
    By Wojciech Sznapka, 7 years ago
  • Travis CI adjustments
    By Wojciech Sznapka, 7 years ago
  • Symfony config update and travis set only to Symfony origin/master
    By Wojciech Sznapka, 7 years ago
  • Updated other symfony dependencies to work with sf 2.2
    By Wojciech Sznapka, 7 years ago
  • Upgrade to wowo queue bundle v1.3.0 and ran php-cs-fixer
    By Wojciech Sznapka, 7 years ago
  • Merge branch 'master' of github.com:wowo/WowoNewsletterBundle
    By Wojciech Sznapka, 7 years ago
  • Updated swiftmailer dependency
    By Wojciech Sznapka, 7 years ago
  • Merge pull request #17 from phansys/master
    By wowo, 8 years ago
  • Added Tests/autoload.php.dist.
    By phansys, 8 years ago
  • Modified requirements to download test packages only in dev mode.
    By phansys, 8 years ago
  • Merge pull request #16 from phansys/master
    By wowo, 8 years ago
  • Added composer install guide in README.markdown.
    By phansys, 8 years ago
  • Added composer install guide in README.markdown.
    By phansys, 8 years ago
  • Merge pull request #13 from spinacz24/BugNewsletter
    By wowo, 8 years ago
  • Fix Newsletter Bundle\Entyty\Mailin.php
    By Rafał Podsiadły, 8 years ago
  • Changed doctrine version to be less than 2.4-dev and greater than 2.2.3
    By Wojciech Sznapka, 8 years ago
  • Changed mockery dependency in composer.json to 0.7.2 from dev-master
    By Wojciech Sznapka, 8 years ago
  • Travis config fixed again (based on monolog one)
    By Wojciech Sznapka, 8 years ago
  • Fixed travis.yml to run composer
    By Wojciech Sznapka, 8 years ago