PHPackages                             leoflapper/mailprovider - 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. leoflapper/mailprovider

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

leoflapper/mailprovider
=======================

Allows you to quickly send mails with different mail services like PHPMailer, Mandrill, SendGrind and Mailgun

v1.1.2(4y ago)51.5k1[1 issues](https://github.com/leoflapper/mailprovider/issues)MITPHPPHP &gt;=5.6.0

Since Jun 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/leoflapper/mailprovider)[ Packagist](https://packagist.org/packages/leoflapper/mailprovider)[ Docs](https://www.leoflapper.nl/)[ RSS](/packages/leoflapper-mailprovider/feed)WikiDiscussions master Synced 2mo ago

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

MailProvider
============

[](#mailprovider)

MailProvider allows you to quickly send mails with PHPMailer or different mail services like Mandrill, SendGrind or Mailgun.

Usage
-----

[](#usage)

The MailProvider allows you to compose an email in a single format. You only have to choose the desired service.

### PHPMailer

[](#phpmailer)

```
    $service = new MailProvider\Service\PHPMailer();
    $service
        ->setProtocol('smtp')
        ->setHost('localhost')
        ->setPort(1025)
        ->addTo('info@myemail.nl', 'Leo Flapper')
        ->addCc('cc@myemail.nl', 'Leo Flapper')
        ->addBcc('bcc@myemail.nl', 'Leo Flapper')
        ->setFrom('info@myhost.nl', 'Leo Flapper')
        ->setSubject('My Subject')
        ->setHtml('Beautiful content')
        ->addAttachment('../LICENSE.md', 'Attachment.txt')
        ->addHeader('MyHeader', 'Value')
        ->setReplyTo('reply@myemail.nl');

    $service->send();
```

### Other mail services

[](#other-mail-services)

```
    //$service = new MailProvider\Service\SendGrid('API-KEY');
    //$service = new MailProvider\Service\Mailgun('API-KEY');
    $service = new MailProvider\Service\Mandrill('API-KEY');
    $service
        ->addTo('info@myemail.nl', 'Leo Flapper')
        ->addCc('cc@myemail.nl', 'Leo Flapper')
        ->addBcc('bcc@myemail.nl', 'Leo Flapper')
        ->setFrom('info@myhost.nl', 'Leo Flapper')
        ->setSubject('My Subject')
        ->setText('My text')
        ->setHtml('Beautiful content')
        ->addAttachment('../LICENSE.md', 'Attachment.txt')
        ->addHeader('MyHeader', 'Value')
        ->setReplyTo('reply@myemail.nl');
    $service->send();
```

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

[](#installation)

Add MailProvider to your `composer.json` file. If you are not using [Composer](http://getcomposer.org), you should be. It's an excellent way to manage dependencies in your PHP application.

```
{
  "require": {
    "leoflapper/mailprovider": "dev-master"
  }
}
```

Then at the top of your PHP script require the autoloader:

```
require 'vendor/autoload.php';
```

Example
-------

[](#example)

There are different examples located inside the examples directory.

Credits
-------

[](#credits)

- [Leo Flapper](https://github.com/leoflapper)
- [Nathan Jansen](https://github.com/nathanjansen)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 90.5% 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 ~501 days

Total

5

Last Release

1620d ago

PHP version history (2 changes)v1.0.1PHP &gt;=5.5.0

v1.0.2PHP &gt;=5.6.0

### Community

Maintainers

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

---

Top Contributors

[![leoflapper](https://avatars.githubusercontent.com/u/2369607?v=4)](https://github.com/leoflapper "leoflapper (19 commits)")[![nathanjansen](https://avatars.githubusercontent.com/u/73473323?v=4)](https://github.com/nathanjansen "nathanjansen (2 commits)")

---

Tags

mailemailprovidersendgridmailgunmandrillphp-mailer

### Embed Badge

![Health badge](/badges/leoflapper-mailprovider/health.svg)

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

###  Alternatives

[omnimail/omnimail

PHP Library to send email across all platforms using one interface.

32934.3k](/packages/omnimail-omnimail)[slm/mail

Integration of various email service providers in the Laminas\\Mail

108732.4k1](/packages/slm-mail)[boundstate/yii2-mailgun

Mailgun integration for the Yii framework

28160.6k](/packages/boundstate-yii2-mailgun)[yarcode/yii2-mailgun-mailer

Mailgun mailer implementation for Yii2

1576.0k](/packages/yarcode-yii2-mailgun-mailer)

PHPackages © 2026

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