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

ActiveLibrary

parfumix/mailer
===============

Mailer based on swift mailer.

054PHP

Since Jul 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/parfumix/mailer)[ Packagist](https://packagist.org/packages/parfumix/mailer)[ RSS](/packages/parfumix-mailer/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Mailer
======

[](#mailer)

Mailer is a simple package based on SwiftMailer which allow sending messages with different drivers.

### Instalation

[](#instalation)

You can use the `composer` package manager to install. Either run:

```
$ php composer.phar require parfumix/mailer "dev-master"

```

or add:

```
"parfumix/mailer": "dev-master"

```

to your composer.json file

Configuration
=============

[](#configuration)

If you use DotEnv package all you have to do is to populate your ***.env*** file.

```
MAIL_DRIVER=smtp // Allow to select transport
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=your_gmail@gmail.com
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=ssl
```

and start using

```
$mailer = (new Mailer(
    new Mailer\Transport
))->alwaysFrom('your_email_always_from@gmail.com', 'Your name')
    ->alwaysReplyTo('reply_to@gmailcom', 'Reply name');
```

If you use other storage repository you can create new Mailer instance and populate with config data from array

```
$config = array(
    'driver' => 'smtp',
    'host' => 'smtp.gmail.com',
    'port' => 465,
    'username' => 'you_email@gmail.com',
    'password' => 'your_passwd',
    'encryption' => 'ssl'
);

$mailer = (new Mailer\Mailer(
    new Mailer\Transport( $config )
))->alwaysFrom('your_email_always_from@gmail.com', 'Your name')
    ->alwaysReplyTo('reply_to@gmailcom', 'Reply name');
```

If you want add custom transport all you have to do is to create new transport class which implement ***TransportAble***

```
class ArrayTransport extends Transport
    implements TransportAble {

    /**
     * {@inheritdoc}
     */
    public function send(Swift_Mime_Message $message, &$failedRecipients = null) {
        $this->beforeSendPerformed($message);

        // Send your message

        return $this->numberOfRecipients($message);
    }
}
```

And register driver to Transport class.

```
$tranport = (new Mailer\Transport([
    'driver' => 'my_driver'
]))->extend('my_driver', function($transport) {
    return new ArrayTransport()
});

$mailer = (new Mailer($tranport))
->alwaysFrom('your_email_always_from@gmail.com', 'Your name')
    ->alwaysReplyTo('reply_to@gmailcom', 'Reply name');
```

Usage
=====

[](#usage)

You can use directly ***Mailer*** and send messages by using ***::to('[to\_email@gmail.com](mailto:to_email@gmail.com)')*** method

```
$mailer->to('to_email@gmail.com', 'Subject')
    ->send('This is a test message');

$mailer->to('to_email@gmail.com', 'Subject')->send('Message body', null, function (\Mailer\Message $message) {
    return $message->setFrom('other_from_email@gmail.com');
});
```

or you can create ***Mailable*** classes which require ***build*** method

```
class NewPayment extends \Mailer\Mail
    implements \Mailer\Mailable {

    public function build() {
        $this->text('Body message');
    }
}

$mailer->to(array(
    'to_email@gmail.com'
))->send( new NewPayment('Subject message') );
```

You can change driver using ***with*** method:

```
$mailer->to('to_email@gmail.com', 'Subject')
    ->with('sendmail')
    ->send('This is a test message');
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

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.

### Community

Maintainers

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

---

Top Contributors

[![parfumix](https://avatars.githubusercontent.com/u/6368534?v=4)](https://github.com/parfumix "parfumix (40 commits)")

---

Tags

mailertransport

### Embed Badge

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

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

PHPackages © 2026

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