PHPackages                             inventor96/mako-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. inventor96/mako-mailer

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

inventor96/mako-mailer
======================

A simple emailing package for the PHP Mako framework.

v1.0.3(3mo ago)0121MITPHPPHP ~8.1.0|~8.2.0|~8.3.0

Since Oct 22Pushed 3mo agoCompare

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

READMEChangelog (4)Dependencies (2)Versions (5)Used By (1)

Mako Mailer
===========

[](#mako-mailer)

A simple emailing package for the PHP Mako framework. It provides an abstraction layer over email sending libraries, allowing for easy swapping of underlying implementations. The default adapter uses PHPMailer (included in this package).

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

[](#installation)

1. Install the composer package:

    ```
    composer require inventor96/mako-mailer
    ```
2. Enable the package in Mako:
    `app/config/application.php`:

    ```
    [
        'packages' => [
            'web' => [
                \inventor96\MakoMailer\MailerPackage::class
            ],
        ],
    ];
    ```

    This will automatically register the `Mailer` class in the Mako dependency injection container, including the alias `mailer`.

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

[](#configuration)

Create a new file at `app/config/packages/mailer/email.php`, and add any of the following applicable configuration options:

```
return [
    /**
     * The name of the sender.
     */
    'from_name' => 'MakoMailer',

    /**
     * The email address of the sender.
     */
    'from_email' => 'noreply@example.com',

    /**
     * The email adapter class to use.
     * Must implement `inventor96\MakoMailer\interfaces\EmailSenderInterface`.
     */
    'adapter' => inventor96\MakoMailer\adapters\PHPMailerAdapter::class,

    /**
     * ========= PHPMailer Settings =========
     */

    /**
     * Whether to use SMTP for sending emails.
     * Set to `false` to use the mail() function.
     */
    'use_smtp' => true,

    /**
     * SMTP server host.
     */
    'host' => 'smtp.example.com',

    /**
     * SMTP server port.
     */
    'port' => 465,

    /**
     * Encryption method to use.
     * Set to empty string to disable encryption.
     */
    'encryption' => PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_SMTPS,

    /**
     * Whether to use SMTP authentication.
     */
    'auth' => true,

    /**
     * SMTP username.
     */
    'username' => 'noreply@example.com',

    /**
     * SMTP password.
     */
    'password' => 'MySecurePassword123!',
];
```

Usage
-----

[](#usage)

### Basics

[](#basics)

You can use the `inventor96\MakoMailer\Mailer` or the `mailer` alias in the Mako dependency injection container. Here's a basic example in the context of a controller method:

```
use inventor96\MakoMailer\Mailer;
use inventor96\MakoMailer\EmailUser;

function sendWelcomeEmail(Mailer $mailer) {
    $to = new EmailUser('recipient@example.com', 'Recipient Name');
    $from = new EmailUser('noreply@example.com', 'MakoMailer');

    $sent = $mailer->send( // alternatively use `$this->mailer->send();` if using the alias
        [$to],
        'Welcome to Mako Mailer!',
        'Hello and welcome to Mako Mailer!',
        $from, // optional, will use config defaults if not provided
    );

    if ($sent) {
        echo "Email sent successfully!";
    } else {
        echo "Failed to send email.";
    }
}
```

### Email Templates

[](#email-templates)

You can also use Mako's view templates for email content. Here's an example:

```
use inventor96\MakoMailer\Mailer;
use inventor96\MakoMailer\EmailUser;

function sendWelcomeEmail(Mailer $mailer) {
    $to = new EmailUser('recipient@example.com', 'Recipient Name');
    $from = new EmailUser('noreply@example.com', 'MakoMailer');

    $sent = $mailer->sendTemplate(
        [$to],
        'Welcome to Mako Mailer!',
        'emails/welcome', // path to the view template, relative to the views directory. e.g. 'emails/welcome' for 'app/resources/views/emails/welcome.tpl.php'
        [
            'name' => 'Recipient Name',
        ],
        $from, // optional, will use config defaults if not provided
    );

    if ($sent) {
        echo "Email sent successfully!";
    } else {
        echo "Failed to send email.";
    }
}
```

### EmailUser

[](#emailuser)

The `EmailUser` class is a simple value object that represents an email user (i.e., the sender or recipient of an email). It contains the user's email address and name. You can either create an instance of `EmailUser` directly (as shown above) or use the static `fromUser()` method to create an instance from an object that implements `inventor96\MakoMailer\interfaces\EmailUserInterface`:

```
use inventor96\MakoMailer\EmailUser;
use inventor96\MakoMailer\interfaces\EmailUserInterface;
use mako\gatekeeper\entities\user\User as GatekeeperUser;

class User extends GatekeeperUser implements EmailUserInterface {
    public function getEmail(): string {
        return $this->email;
    }

    public function getName(): string {
        return $this->first_name . ' ' . $this->last_name;
    }
}

$user = User::getOrThrow(1); // fetch user from database
$to = EmailUser::fromUser($user);

$mailer->send([$to], 'Subject', 'Email body');
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance81

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

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 ~33 days

Total

4

Last Release

102d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

emailmakomailer

### Embed Badge

![Health badge](/badges/inventor96-mako-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/inventor96-mako-mailer/health.svg)](https://phpackages.com/packages/inventor96-mako-mailer)
```

###  Alternatives

[aplus/email

Aplus Framework Email Library

2461.6M3](/packages/aplus-email)[sylius/mailer-bundle

Mailers and e-mail template management for Symfony projects.

728.1M77](/packages/sylius-mailer-bundle)[voku/bounce-mail-handler

Bounce Mail Handler

49230.9k2](/packages/voku-bounce-mail-handler)[nickcv/yii2-mandrill

Mandrill Api Integration for Yii2

29554.2k2](/packages/nickcv-yii2-mandrill)[boundstate/yii2-mailgun

Mailgun integration for the Yii framework

28160.6k](/packages/boundstate-yii2-mailgun)[hafael/azure-mailer-driver

Supercharge your Laravel or Symfony app with Microsoft Azure Communication Services (ACS)! Effortlessly add email, chat, voice, video, and telephony-over-IP for next-level communication. 🚀

14109.2k](/packages/hafael-azure-mailer-driver)

PHPackages © 2026

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