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

WhiteOctoberSwiftMailerDBBundle

by sampart

A bundle to facilitate SwiftMailer spooling messages to a database

This project is looking for maintainers - details here.

SwiftMailerDBBundle

This project was originally at https://github.com/whiteoctober/WhiteOctoberSwiftMailerDBBundle

Latest Stable Version
Total Downloads
Monthly Downloads
License

SwiftMailer

This bundle faciliates using a database to spool messages to with SwiftMailer and Symfony2.

At present, it only works with the Doctrine EntityManager and entities managed with this.

Installation and configuration

1. Install via Composer

$ composer require "whiteoctober/swiftmailerdbbundle:^1.0"

2. Add the bundle to your application's kernel

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new WhiteOctober\SwiftMailerDBBundle\WhiteOctoberSwiftMailerDBBundle(),
        // ...
    );
}

3. Configure the white_october_swift_mailer_db in config.yml

white_october_swift_mailer_db:
    entity_class: AppBundle\Entity\Email

Read below about how to construct this entity.

4. Tell SwiftMailer to use the database spooler

swiftmailer:
    spool:
        type: db

That's it for bundle installation and configuration.

Mail entity

You will need to create an entity that can be persisted and that extends from the
EmailInterface interface in the bundle. At the moment, the bundle expects a
property to be available on your entity called 'status', since this field is queried.

Once you have your entity all set up, use the full namespaced path in your config.yml
configuration as detailed above.

Optional: keeping sent messages in the database

By default, messages which were succesfully sent will be deleted from the database. It is possible to configure
the bundle to keep those messages in your config.yml:

white_october_swift_mailer_db:
    keep_sent_messages: true

Optional: using separate entity manager for emails

When a message is sent with configured database spool $em->flush is called on default entity manager. This may
cause side effects, so in order to flush only Email entity, put it in a separate bundle and configure separate
entity manager for that bundle. For example:

white_october_swift_mailer_db:
    entity_class: MailBundle\Entity\Email

doctrine:
    orm:
        entity_managers:
            default:
                connection: default
                auto_mapping: true
            mail:
                connection: default
                mappings:
                    MailBundle: ~

Contributing

We welcome contributions to this project, including pull requests and issues (and discussions on existing issues).

If you'd like to contribute code but aren't sure what, the issues list is a good place to start.
If you're a first-time code contributor, you may find Github's guide to forking projects helpful.

All contributors (whether contributing code, involved in issue discussions, or involved in any other way) must abide by our code of conduct.

white_october_swift_mailer_db:
entity_class: ~ # Required
keep_sent_messages: false
  • Add note about where this repo used to live
    By web-flow, 11 days ago
  • Add note about looking for maintainers
    By Sam Partington, 1 year ago
  • Merge pull request #28 from whiteoctober/ignore-composer-lock
    By web-flow, 1 year ago
  • Pull Request #26 remove the composer.lock file, but didn't ignore it.
    By Sam Partington, 1 year ago
  • Merge pull request #26 from whiteoctober/remove-composer-lock
    By web-flow, 2 years ago
  • Remove composer.lock file
    By olorton, 2 years ago
  • Merge pull request #25 from agallou/1.1.0_fix_transport_start
    By web-flow, 2 years ago
  • start transport only if there is an email to send
    By agallou, 2 years ago
  • Merge pull request #22 from whiteoctober/code-of-conduct
    By web-flow, 3 years ago
  • Add code-of-conduct, plus "Contributing" section in README
    By Sam Partington, 3 years ago
  • Merge pull request #21 from dpk125/configurable-manager
    By web-flow, 3 years ago
  • Make object manager configurable
    By Daniil Pyšniak, 3 years ago
  • Merge pull request #18 from dfridrich/enhancements
    By web-flow, 4 years ago
  • Remove .git dir
    By dfridrich, 4 years ago
  • Add line to gitignore
    By dfridrich, 4 years ago
  • Fix README
    By dfridrich, 4 years ago
  • Fix README
    By dfridrich, 4 years ago
  • Example entity in AppBundle
    By dfridrich, 4 years ago
  • Add SwiftMailer logo
    By dfridrich, 4 years ago
  • Enhance README
    By dfridrich, 4 years ago
  • Add gitignore, update composer
    By dfridrich, 4 years ago
  • Add setters to interface
    By dfridrich, 4 years ago
  • Merge pull request #13 from whiteoctober/12-doctrine-manager
    By richsage, 5 years ago
  • Make queue flushing work with deferred explicit change tracking policy
    By richsage, 5 years ago
  • Use Doctrine manager to enable reset if required
    By richsage, 5 years ago
  • Merge pull request #11 from lenar/patch-1
    By richsage, 6 years ago
  • Make queue flushing work with deferred explicit change tracking policy
    By lenar, 6 years ago
  • Merge pull request #10 from sam0delkin/add-env-support
    By richsage, 6 years ago
  • Add environment support for emails spooling
    By sam0delkin, 6 years ago
  • Merge pull request #7 from choonge/issue_6
    By richsage, 6 years ago