PHPackages                             tourze/email-direct-marketing-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. tourze/email-direct-marketing-bundle

ActiveSymfony-bundle[Mail &amp; Notifications](/categories/mail)

tourze/email-direct-marketing-bundle
====================================

Email direct marketing bundle for Symfony applications

0.0.1(11mo ago)00MITPHPPHP ^8.1CI failing

Since May 29Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/email-direct-marketing-bundle)[ Packagist](https://packagist.org/packages/tourze/email-direct-marketing-bundle)[ RSS](/packages/tourze-email-direct-marketing-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (34)Versions (2)Used By (0)

Email Direct Marketing Bundle
=============================

[](#email-direct-marketing-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/c5d51c97fd2f847ba65ebc25bf71361725bcc0a59eabe4c04f55152992e27a03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f656d61696c2d6469726563742d6d61726b6574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/email-direct-marketing-bundle)[![Total Downloads](https://camo.githubusercontent.com/c6c46d177bd2757b27c5c4b57b645fa5aa803de1123cf1d540ab75bd6e013d2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f656d61696c2d6469726563742d6d61726b6574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/email-direct-marketing-bundle)[![PHP Version](https://camo.githubusercontent.com/22c5e910436c7c32c0fea70cd2926933ffd2e0bd63795930847b78263a338810/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f656d61696c2d6469726563742d6d61726b6574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/email-direct-marketing-bundle)[![License](https://camo.githubusercontent.com/a0a43696d006a39377111b3c8abf4a390061dc14d3f507be779264abd99fd968/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f656d61696c2d6469726563742d6d61726b6574696e672d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/email-direct-marketing-bundle)[![Build Status](https://camo.githubusercontent.com/0346e18af1343d739d0405776c07b83798d5bb0200e3efcfdf657e5e662f6403/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f75727a652f7068702d6d6f6e6f7265706f2f63692e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/tourze/php-monorepo/actions)[![Code Coverage](https://camo.githubusercontent.com/6ce0146325478eb7cebae4cc6139b2af2c161735dd0e3c6ff6802f2c5a708179/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f746f75727a652f7068702d6d6f6e6f7265706f3f7374796c653d666c61742d737175617265)](https://codecov.io/gh/tourze/php-monorepo)

A Symfony bundle for managing email marketing campaigns with support for bulk email sending, template management, and detailed tracking.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Quick Start](#quick-start)
- [Console Commands](#console-commands)
- [Admin Interface](#admin-interface)
- [Advanced Usage](#advanced-usage)
- [Security](#security)
- [Contributing](#contributing)
- [License](#license)
- [References](#references)

Features
--------

[](#features)

- **Campaign Management**: Create and manage email marketing campaigns with customizable templates
- **Receiver Management**: Organize receivers with tags for targeted campaigns
- **Sender Pool**: Support multiple sender email addresses with rotation
- **Template System**: Rich HTML email templates with variable substitution
- **Queue System**: Asynchronous email sending with Symfony Messenger
- **Admin Interface**: Complete EasyAdmin integration for managing campaigns
- **Tracking**: Monitor campaign performance with success/failure statistics
- **Scheduling**: Schedule campaigns to start at specific times
- **Tag-based Targeting**: Send emails to receivers based on tag filtering

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Symfony 7.3 or higher
- Doctrine ORM 3.0 or higher
- Symfony Messenger component
- Symfony Mailer component

Installation
------------

[](#installation)

```
composer require tourze/email-direct-marketing-bundle
```

Configuration
-------------

[](#configuration)

### Messenger Transport

[](#messenger-transport)

Configure Messenger to handle email queue processing:

```
# config/packages/messenger.yaml
framework:
    messenger:
        transports:
            async: '%env(MESSENGER_TRANSPORT_DSN)%'
        routing:
            EmailDirectMarketingBundle\Message\SendQueueEmailMessage: async
```

### Database Schema

[](#database-schema)

The bundle will create the following tables:

- `ims_edm_task` - Email marketing campaigns
- `ims_edm_template` - Email templates
- `ims_edm_sender` - Sender email addresses
- `ims_edm_receiver` - Email recipients
- `ims_edm_queue` - Email sending queue

Quick Start
-----------

[](#quick-start)

### Enable the Bundle

[](#enable-the-bundle)

Register the bundle in your `bundles.php`:

```
return [
    // ...
    EmailDirectMarketingBundle\EmailDirectMarketingBundle::class => ['all' => true],
];
```

#### Configure Database

[](#configure-database)

Run migrations to create the required database tables:

```
php bin/console doctrine:migrations:migrate
```

#### Configure Messenger

[](#configure-messenger)

Add the message handler to your messenger configuration:

```
# config/packages/messenger.yaml
framework:
    messenger:
        transports:
            async: '%env(MESSENGER_TRANSPORT_DSN)%'
        routing:
            EmailDirectMarketingBundle\Message\SendQueueEmailMessage: async
```

#### Basic Usage

[](#basic-usage)

Create a campaign through the admin interface or programmatically:

```
use EmailDirectMarketingBundle\Entity\Task;
use EmailDirectMarketingBundle\Entity\Template;
use EmailDirectMarketingBundle\Enum\TaskStatus;

// Create a template
$template = new Template();
$template->setName('Welcome Email');
$template->setSubject('Welcome to ${receiver.getName()}!');
$template->setHtmlBody('Hello ${receiver.getName()}');

// Create a task
$task = new Task();
$task->setTitle('Welcome Campaign');
$task->setTemplate($template);
$task->setTags(['new-users']);
$task->setStartTime(new \DateTimeImmutable('+1 hour'));
$task->setStatus(TaskStatus::WAITING);
```

Console Commands
----------------

[](#console-commands)

### edm:start-task

[](#edmstart-task)

Check and start email marketing tasks that are ready to be sent.

```
# Check and start all pending tasks
php bin/console edm:start-task

# Start a specific task
php bin/console edm:start-task --task-id=123

# Force start a task (ignore start time)
php bin/console edm:start-task --task-id=123 --force
```

This command is designed to be run as a cron job (every minute) to automatically process scheduled campaigns.

Admin Interface
---------------

[](#admin-interface)

The bundle provides EasyAdmin controllers for managing:

- **Tasks**: Create and monitor email campaigns
- **Templates**: Design email templates with variable substitution
- **Senders**: Manage sender email addresses
- **Receivers**: Organize email recipients with tags
- **Queues**: Monitor email sending queue and status

Template Variables
------------------

[](#template-variables)

Templates support variable substitution using the `${expression}` syntax:

- `${receiver.getName()}` - Receiver's name
- `${receiver.getEmailAddress()}` - Receiver's email
- `${task.getTitle()}` - Campaign title
- `${now.format('Y-m-d')}` - Current date

Advanced Usage
--------------

[](#advanced-usage)

### Custom Variable Providers

[](#custom-variable-providers)

You can extend the template system with custom variables by creating a service that implements variable providers:

```
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;

class CustomVariableProvider
{
    public function addVariables(ExpressionLanguage $expressionLanguage): void
    {
        $expressionLanguage->register('customVar',
            function () {
                return 'your custom value';
            },
            function ($arguments) {
                return 'your custom value';
            }
        );
    }
}
```

#### Queue Processing Optimization

[](#queue-processing-optimization)

For high-volume campaigns, consider optimizing queue processing:

```
# config/packages/messenger.yaml
framework:
    messenger:
        transports:
            async:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    max_retries: 3
                    delay: 1000
```

#### Monitoring and Logging

[](#monitoring-and-logging)

The bundle integrates with Symfony's logging system:

```
# config/packages/monolog.yaml
monolog:
    handlers:
        email_marketing:
            type: rotating_file
            path: '%kernel.logs_dir%/email_marketing.log'
            level: info
            channels: ['email_marketing']
```

Architecture
------------

[](#architecture)

The bundle follows a queue-based architecture:

1. **Task Creation**: Define campaign with template, tags, and schedule
2. **Queue Generation**: When task starts, create queue items for each matching receiver
3. **Async Processing**: Queue items are processed by message handlers
4. **Status Tracking**: Monitor success/failure for each email

Security
--------

[](#security)

### Email Validation

[](#email-validation)

The bundle includes built-in email validation:

- Receiver email addresses are validated before adding to queue
- Sender email addresses must be verified
- DMARC/SPF records are recommended for production use

#### Rate Limiting

[](#rate-limiting)

Consider implementing rate limiting for your SMTP provider:

```
# config/packages/mailer.yaml
framework:
    mailer:
        transports:
            main: '%env(MAILER_DSN)%'
        envelope:
            sender: 'noreply@example.com'
```

#### Data Protection

[](#data-protection)

- Receiver data is encrypted at rest
- Email content can be sanitized before storage
- Unsubscribe functionality is built-in

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

References
----------

[](#references)

- [Sending Emails with Mailer](https://symfony.com/doc/current/mailer.html)
- [Email Authentication and Trust](https://buaq.net/go-141400.html)
- [DMARC Configuration Guide](https://service.exmail.qq.com/cgi-bin/help?subtype=1&no=1001520&id=16)
- [Email Spam Testing](https://www.mail-tester.com/)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance64

Regular maintenance activity

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

348d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e354fdb316da535dfa8ba2e9193a473c403b6bc6fb9170778d1dc50e304c6e9d?d=identicon)[tourze](/maintainers/tourze)

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (4 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-email-direct-marketing-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-email-direct-marketing-bundle/health.svg)](https://phpackages.com/packages/tourze-email-direct-marketing-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
