PHPackages                             buibr/laramic-mailer - 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. buibr/laramic-mailer

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

buibr/laramic-mailer
====================

When you need dynamic mailing, multiple mail server

v0.1(1y ago)10PHPPHP ^8.2

Since Sep 9Pushed 1y ago1 watchersCompare

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

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

Laramic Mailer is a Laravel plugin that allows dynamic email configuration based on database-stored settings. This package makes it easy to manage multiple mail configurations and send emails without hardcoding your email settings in .env files.

Features
--------

[](#features)

- Dynamic Mail Configuration: Fetch mail settings from the database and apply them on the fly.
- Seamless Integration: Easily integrates with Laravel's native mail functionality.
- Multi-Mailer Support: Supports multiple mailers for different use cases.
- Flexible Setup: Define your own mailer configurations in the database, including SMTP host, port, encryption, and more.
- Configurable Sender Info: Dynamically configure "From" name and address for each mail.
- Extensible: Customize how mail configurations are stored and retrieved.

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

[](#installation)

#### Step 1: Install via Composer

[](#step-1-install-via-composer)

To install the package, run the following command:

```
composer require buibr/laramic-mailer
```

#### Step 2: Publish Configuration and Migration

[](#step-2-publish-configuration-and-migration)

After installation, publish the configuration and migration files:

```
php artisan vendor:publish --tag=laramic-mailer-config
php artisan migrate
```

#### Usage

[](#usage)

Add your mail configurations directly in the database (SMTP host, port, encryption, etc.). When sending emails, the plugin will fetch the necessary mailer configuration from the database and apply it on the fly. You can define and manage multiple mailers for different purposes, all stored in the database.

Example to use of Dynami MailServer server and laramic with defualt laravel functionality:

```
// from
Mail::to($request->user())->send(new OrderShipped($order));

// to
Laramic::use($ticketCommunication->mailServer)
    ->to($request->user())
    ->send(new InvoiceEmail(Invoice $invoice));
```

All other laravel Mail or MailManager methods as parent layer of Laramic can be used normaly. See: [https://laravel.com/docs/11.x/mail\[url\](https://laravel.com/docs/11.x/mail)\]](https://laravel.com/docs/11.x/mail%5Burl%5D(https://laravel.com/docs/11.x/mail)%5D)

#### Testing

[](#testing)

```
