PHPackages                             dinara/email-marketing - 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. dinara/email-marketing

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

dinara/email-marketing
======================

Email marketing package for Laravel with campaigns, templates, open/click tracking, and rate limiting

v1.7.1(2mo ago)031MITBladePHP ^8.1

Since Feb 13Pushed 2mo agoCompare

[ Source](https://github.com/Dinara2020/email-marketing)[ Packagist](https://packagist.org/packages/dinara/email-marketing)[ Docs](https://github.com/dinara/email-marketing)[ RSS](/packages/dinara-email-marketing/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (32)Used By (0)

Laravel Email Marketing
=======================

[](#laravel-email-marketing)

A comprehensive email marketing package for Laravel with campaigns, templates, tracking, and rate limiting. **SaaS-ready with multi-tenancy support.**

Features
--------

[](#features)

- **Email Templates** - Create and manage reusable email templates with variable support
- **Campaigns** - Organize email sends into campaigns with statistics
- **Open Tracking** - Track when recipients open emails via tracking pixel
- **Click Tracking** - Track link clicks with automatic URL wrapping
- **Rate Limiting** - Built-in rate limiting (configurable, default 10 emails/hour)
- **Queue Support** - Send emails via Laravel queues with random delays
- **Bounce Detection** - Automatic detection of bounced/invalid emails
- **SMTP Configuration** - Configure SMTP settings from admin panel (stored in database)
- **Multi-tenancy** - SaaS-ready with per-tenant SMTP settings
- **Admin Dashboard** - Full admin interface for managing everything
- **Standalone Layout** - Works out of the box with built-in Bootstrap 5 admin panel

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

[](#requirements)

- PHP 8.1+
- Laravel 8.x, 9.x, 10.x, or 11.x
- Redis (recommended for queues)

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

[](#installation)

```
composer require dinara/email-marketing
```

Run migrations:

```
php artisan migrate
```

Optionally publish configuration:

```
php artisan vendor:publish --tag=email-marketing-config
```

Optionally publish views for customization:

```
php artisan vendor:publish --tag=email-marketing-views
```

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

[](#configuration)

### Minimal Setup

[](#minimal-setup)

Add to your `.env` file:

```
# Required: Your lead/recipient model
EMAIL_MARKETING_LEAD_MODEL=App\Models\Lead
```

That's it! The package works out of the box with:

- Built-in Bootstrap 5 admin panel
- SMTP settings stored in database (configurable from admin panel)
- Default rate limiting (10 emails/hour)

### Full Configuration

[](#full-configuration)

```
# Required: Your lead/recipient model
EMAIL_MARKETING_LEAD_MODEL=App\Models\Lead

# Optional: Database connection for leads (null = default)
EMAIL_MARKETING_LEAD_CONNECTION=null

# Optional: Model for logo images (must have: type, src columns)
EMAIL_MARKETING_IMAGES_MODEL=App\Models\Images

# Optional: Use your own layout (null = use package's built-in layout)
EMAIL_MARKETING_LAYOUT=admin.layout

# Optional: Admin panel route prefix
EMAIL_MARKETING_ROUTE_PREFIX=admin/email-marketing

# Optional: Rate limiting
EMAIL_MARKETING_RATE_LIMIT=10
EMAIL_MARKETING_BASE_DELAY=360
EMAIL_MARKETING_RANDOM_DELAY=120
```

### Multi-tenancy (SaaS)

[](#multi-tenancy-saas)

For SaaS applications with multiple tenants, configure a tenant resolver in `config/email-marketing.php`:

```
'tenant_resolver' => fn() => auth()->user()?->tenant_id,
```

Each tenant will have their own SMTP settings stored in the `email_smtp_settings` table.

Example with Spatie Laravel Multitenancy:

```
'tenant_resolver' => fn() => app('currentTenant')?->id,
```

Usage
-----

[](#usage)

### Access Admin Panel

[](#access-admin-panel)

Navigate to `/admin/email-marketing` (or your configured prefix).

### Available Routes

[](#available-routes)

RouteDescription`email-marketing.index`Dashboard`email-marketing.smtp`SMTP Settings`email-marketing.templates`Template List`email-marketing.templates.create`Create Template`email-marketing.campaigns`Campaign List`email-marketing.campaigns.create`Create Campaign### Template Variables

[](#template-variables)

Templates support the following variables:

VariableDescription`{{hotel_name}}`Company/recipient name`{{contact_name}}`Contact person name`{{contact_email}}`Recipient email`{{current_date}}`Current date`{{sender_name}}`Sender name`{{sender_company}}`Sender company`{{logo_url}}`Company logo URL`{{site_url}}`Website URL`{{site_name}}`Website name### Running Queue Worker

[](#running-queue-worker)

For sending emails via queue:

```
php artisan queue:work
```

Or use Laravel Horizon for Redis queues:

```
php artisan horizon
```

### Programmatic Usage

[](#programmatic-usage)

```
use Dinara\EmailMarketing\Models\EmailTemplate;
use Dinara\EmailMarketing\Models\EmailCampaign;
use Dinara\EmailMarketing\Services\EmailCampaignService;
use Dinara\EmailMarketing\Services\SmtpConfigService;

// Create a template
$template = EmailTemplate::create([
    'name' => 'Welcome Email',
    'subject' => 'Welcome {{contact_name}}!',
    'body_html' => 'Hello {{contact_name}}Welcome to our service!',
    'is_active' => true,
]);

// Create and start a campaign
$service = app(EmailCampaignService::class);
$campaign = $service->createCampaign(
    name: 'Welcome Campaign',
    templateId: $template->id,
    recipientIds: [1, 2, 3] // Lead IDs
);

$service->startCampaign($campaign);

// For SaaS: Set tenant before operations
$smtpService = app(SmtpConfigService::class);
$smtpService->setTenant($tenantId);
$settings = $smtpService->getSettings();
```

Database Tables
---------------

[](#database-tables)

The package creates the following tables:

- `email_templates` - Email templates with HTML content
- `email_campaigns` - Campaign metadata and status
- `email_sends` - Individual email sends with tracking
- `email_clicks` - Click tracking data
- `email_smtp_settings` - SMTP settings (supports multi-tenancy)

Tracking
--------

[](#tracking)

### Open Tracking

[](#open-tracking)

Emails automatically include a 1x1 transparent tracking pixel. Opens are recorded with:

- Timestamp
- IP address
- User agent
- Open count

### Click Tracking

[](#click-tracking)

All links in emails are automatically wrapped with tracking URLs. Clicks record:

- Original URL
- Timestamp
- IP address
- User agent

### Bounce Detection

[](#bounce-detection)

The package automatically detects bounced emails based on SMTP error codes (550, 551, 552, 553, 554) and common error messages. Bounced recipients are marked with `email_invalid = true`.

Customization
-------------

[](#customization)

### Custom Lead Model

[](#custom-lead-model)

Your lead model should have at least:

- `id`
- `email`
- `company_name` or `name`
- `manager_name` (optional, for contact person)

### Custom Views

[](#custom-views)

Publish and modify views:

```
php artisan vendor:publish --tag=email-marketing-views
```

Views will be copied to `resources/views/vendor/email-marketing/`.

### Custom Layout

[](#custom-layout)

Set your admin layout in `.env`:

```
EMAIL_MARKETING_LAYOUT=admin.layout
```

Your layout should have a `content` section:

```
@yield('content')
```

Events
------

[](#events)

The package dispatches events you can listen to:

- `EmailSent` - When an email is successfully sent
- `EmailOpened` - When a tracking pixel is loaded
- `EmailClicked` - When a tracked link is clicked
- `EmailBounced` - When an email bounces

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

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

[](#contributing)

Contributions are welcome! Please submit a Pull Request.

Support
-------

[](#support)

For issues and feature requests, please use the [GitHub issue tracker](https://github.com/dinara/email-marketing/issues).

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance87

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Every ~1 days

Total

31

Last Release

63d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e2ee21bf8358779b9100fd48058d81c548417808a8f85c028652033e5c1ff06?d=identicon)[Dinara](/maintainers/Dinara)

---

Tags

laravelemailtrackingmarketingnewslettermailingcampaignsEmail Trackingbulk-email

### Embed Badge

![Health badge](/badges/dinara-email-marketing/health.svg)

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

###  Alternatives

[putyourlightson/craft-campaign

Send and manage email campaigns, contacts and mailing lists.

6435.0k1](/packages/putyourlightson-craft-campaign)[meness/verifi

A Laravel package to handle email verification.

5516.9k](/packages/meness-verifi)[princealikhan/laravel-mautic-api

Free and Open Source Marketing Automation API

415.9k](/packages/princealikhan-laravel-mautic-api)

PHPackages © 2026

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