PHPackages                             samcbdev/mail-notifier - 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. samcbdev/mail-notifier

ActiveLibrary

samcbdev/mail-notifier
======================

Mail template generation based on user's design with custom dynamic variables

1.0.1(1y ago)156MITPHP

Since Jul 11Pushed 1y ago2 watchersCompare

[ Source](https://github.com/samcbdev/mail-notifier)[ Packagist](https://packagist.org/packages/samcbdev/mail-notifier)[ RSS](/packages/samcbdev-mail-notifier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Mail Notifier Package
=====================

[](#mail-notifier-package)

*The Well Organised mail Notification Manager, Ever*
----------------------------------------------------

[](#the-well-organised-mail-notification-manager-ever)

A custom Laravel package for dynamic mail template creation and storage in a database, with the capability to send emails using Laravel Jobs.

Features
--------

[](#features)

- **Dynamic Mail Templates:** Create, store, and manage dynamic mail templates in the database.
- **Filtering:** Easily retrieve templates with custom filter conditions.
- **Dynamic Content Replacement:** Replace dynamic fields within templates.
- **Email Sending:** Send emails with support for CC, BCC, and attachments.
- **Error Handling:** Handles exceptions for cases where mail templates are not found.

Tech Stack
----------

[](#tech-stack)

- **Laravel:** A PHP framework for building modern web applications.
- **Composer:** Dependency manager for PHP.
- **MySQL:** Relational database management system for storing mail templates.
-

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

[](#installation)

1. Composer Install Run the following command to install the package via Composer: ```
    composer require samcbdev/mail-notifier
    ```
2. Vendor Publish Publish the package's configuration and other necessary files: ```
    php artisan vendor:publish --tag="mail-notifier"
    ```
3. Migration Run Run the database migrations to create the necessary tables: ```
    php artisan migrate
    ```

Usage Guide
-----------

[](#usage-guide)

1. Retrieve All Retrieve all mail templates with optional filtering:

    ```
    Mailer::filterCondition()->get();

    // With filters
    $filter = [
        'custom_fields->comp_id' => 1,
    ];
    Mailer::filterCondition($filter)->get();
    ```
2. Retrieve One Retrieve a single mail template with filtering:

    ```
    $filter = [
        'custom_fields->comp_id' => 1,
    ];
    Mailer::filterCondition($filter, true)->get(); // true returns first matching record
    ```
3. Store Store a new mail template:

    ```
    $data = [
        'template_unique_id' => 'FP',
        'custom_fields' => [ // here custom field is json column
            'comp_id' => 1
        ],
        'title' => 'Title',
        'subject' => 'Subject',
        'content' => 'Content',
        'status' => 1
    ];

    $setUnique = ['template_unique_id', 'custom_fields->comp_id'];

    Mailer::storeData($setUnique, $data);
    ```
4. Edit Edit an existing mail template:

    ```
    $data = [
        'template_unique_id' => 'FP',
        'custom_fields' => [
            'comp_id' => 1
        ],
        'title' => 'Title',
        'subject' => 'Subject',
        'content' => 'Content',
        'status' => 2
    ];

    $setUnique = ['template_unique_id', 'custom_fields->comp_id'];

    Mailer::editData(1, $setUnique, $data);
    ```
5. Delete Delete a mail template:

    ```
    Mailer::deleteData(1);
    ```
6. Check Dynamic Strings Check for dynamic strings within a mail template:

    ```
    $filter = [
        'template_unique_id' => 'FP',
        'custom_fields->comp_id' => 1,
    ];
    Mailer::filterCondition($filter, true)->checkDynamicFields();
    ```
7. Replace Dynamic Strings and Send Mail Replace dynamic fields within a mail template and send an email: **setFromAddress** is opitonal functional. If needs to change the from email address and mail, add the function before **senMail** function.

    ```
    $filter = [
        'template_unique_id' => 'FP',
        'custom_fields->comp_id' => 1,
    ];

    $contentArray = [
        '[[content_key]]' => 'replacing string against the key',
    ];

    $subjectArray = [
        '[[subject_key]]' => 'replacing string against the key'
    ];

    $fromAddr = [
        'name' => 'testing',
        'email' => 'from@web.php'
    ];

    $to = ['recipient@example.com'];

    $ccOrBcc = [
        'cc' => ['cc1@example.com', 'cc2@example.com'],
        'bcc' => ['bcc1@example.com']
    ];

    $attachments = [
        storage_path('/app/public/img.jpg'),
        storage_path('/app/public/pdf.pdf')
    ];

    try {
        $ret = Mailer::filterCondition($filter, true)
            ->replaceDynamicFields($contentArray, $subjectArray)
            ->setFromAddress($fromAddr)
            ->sendMail($to, $ccOrBcc, $attachments);
    } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
        return response()->json([
            'error' => 'Mail Not Send',
            'message' => $e->getMessage()
        ], 404);
    }
    ```

Development
-----------

[](#development)

Open your favorite Terminal and run this command.

```
php artisan queue:work
```

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance42

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

Every ~214 days

Total

2

Last Release

462d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e41e33919ef72382201a13a6909c877008593353b35fbe3340f7fa1550ab5c9?d=identicon)[samcbdev](/maintainers/samcbdev)

---

Top Contributors

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

---

Tags

email-notificationsmail notifierdynamic email templates

### Embed Badge

![Health badge](/badges/samcbdev-mail-notifier/health.svg)

```
[![Health](https://phpackages.com/badges/samcbdev-mail-notifier/health.svg)](https://phpackages.com/packages/samcbdev-mail-notifier)
```

###  Alternatives

[jeremykenedy/laravel-exception-notifier

Laravel exception notifier will send an email of of the error along with the stack trace to the chosen recipients.

137264.9k](/packages/jeremykenedy-laravel-exception-notifier)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8674.9k](/packages/illuminated-console-logger)

PHPackages © 2026

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