PHPackages                             leafs/mail - 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. [Framework](/categories/framework)
4. /
5. leafs/mail

ActiveLibrary[Framework](/categories/framework)

leafs/mail
==========

Leaf PHP bareui templating engine

v2.2(1y ago)62.2k4[2 issues](https://github.com/leafsphp/mail/issues)MITPHP

Since Sep 19Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/leafsphp/mail)[ Packagist](https://packagist.org/packages/leafs/mail)[ Docs](https://leafphp.netlify.app/#/)[ GitHub Sponsors](https://github.com/leafsphp)[ Fund](https://opencollective.com/leaf)[ RSS](/packages/leafs-mail/feed)WikiDiscussions next Synced 2d ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

 [![](https://camo.githubusercontent.com/e83224618735d048f0f70f04e02d7973a634a055e18d47fe22501e3a85e40b9f/68747470733a2f2f6c6561667068702e6e65746c6966792e6170702f6173736574732f696d672f6c656166332d6c6f676f2e706e67)](https://camo.githubusercontent.com/e83224618735d048f0f70f04e02d7973a634a055e18d47fe22501e3a85e40b9f/68747470733a2f2f6c6561667068702e6e65746c6966792e6170702f6173736574732f696d672f6c656166332d6c6f676f2e706e67)

Leaf Mail Module
================

[](#leaf-mail-module)

Leaf Mail v2
============

[](#leaf-mail-v2)

[![Latest Stable Version](https://camo.githubusercontent.com/c744960f628dbbd511b7e6f3ac7bbbaeafb7d0f0fd35a287267112578bbb1835/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f6d61696c2f762f737461626c65)](https://packagist.org/packages/leafs/mail)[![Total Downloads](https://camo.githubusercontent.com/f88c6dfa20b51d8a1b6af0c722d37626321de83091414046d2f3b4b947b0d596/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f6d61696c2f646f776e6c6f616473)](https://packagist.org/packages/leafs/mail)[![License](https://camo.githubusercontent.com/f3dfd2a8664d8251c808c94e06ed6cc43d2ba168a83c0a92cad3d8528565c02d/68747470733a2f2f706f7365722e707567782e6f72672f6c656166732f6d61696c2f6c6963656e7365)](https://packagist.org/packages/leafs/mail)

Mailing in PHP apps has always been seen as a daunting task. Leaf Mail provides a simple, straightforward and efficient email API that is built on the widely used PHPMailer Library component.

With Leaf Mail, you can easily send emails using various drivers and services such as SMTP, Mailgun, SendGrid, Amazon SES, and sendmail. This flexibility enables you to swiftly begin sending emails through a preferred local or cloud-based service.

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

[](#installation)

You can install leaf mail using the leaf cli:

```
leaf install mail
```

or with composer:

```
composer require leafs/mail
```

Basic Usage
-----------

[](#basic-usage)

Leaf Mail provides a Mailer class that is responsible for validating and sending emails. This class handles the connection to your mail server, the configuration for how to send your emails and the actual sending of emails.

It also provides a mailer() method that is responsible for creating and formatting emails. Most of the time, you'll be using the mailer() method to create and send emails.

Note that you need to setup the connection to your mail server using the Leaf\\Mail\\Mailer class before sending your emails.

### Configure your mailer

[](#configure-your-mailer)

```
use Leaf\Mail\Mailer;
use PHPMailer\PHPMailer\PHPMailer;

...

Mailer::connect([
  'host' => 'smtp.mailtrap.io',
  'port' => 2525,
  'charSet' => PHPMailer::CHARSET_UTF8,
  'security' => PHPMailer::ENCRYPTION_STARTTLS,
  'auth' => [
    'username' => 'MAILTRAP_USERNAME',
    'password' => 'MAILTRAP_PASSWORD'
  ]
]);
```

### Send your mails

[](#send-your-mails)

```
mailer()
  ->create([
    'subject' => 'Leaf Mail Test',
    'body' => 'This is a test mail from Leaf Mail using gmail',

    // next couple of lines can be skipped if you
    // set defaults in the Mailer config
    'recipientEmail' => 'name@mail.com',
    'recipientName' => 'First Last',
    'senderName' => 'Leaf Mail',
    'senderEmail' => 'mychi@leafphp.dev',
  ])
  ->send();
```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance46

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.2% 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 ~389 days

Total

4

Last Release

581d ago

Major Versions

v1.0 → v2.0.02023-06-14

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29547806?v=4)[Mychi](/maintainers/Mychi)[@mychi](https://github.com/mychi)

---

Top Contributors

[![mychidarko](https://avatars.githubusercontent.com/u/26604242?v=4)](https://github.com/mychidarko "mychidarko (16 commits)")[![eminsr](https://avatars.githubusercontent.com/u/15310365?v=4)](https://github.com/eminsr "eminsr (2 commits)")[![screenfluent](https://avatars.githubusercontent.com/u/116732045?v=4)](https://github.com/screenfluent "screenfluent (1 commits)")

---

Tags

phpframeworktemplateviewleafsimple templating

### Embed Badge

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

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

###  Alternatives

[slim/php-view

Render PHP view scripts into a PSR-7 Response object.

2849.9M101](/packages/slim-php-view)[slim/twig-view

Slim Framework 4 view helper built on top of the Twig 3 templating component

3738.7M235](/packages/slim-twig-view)[sproutcms/cms

Enterprise content management and framework

242.5k4](/packages/sproutcms-cms)

PHPackages © 2026

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