PHPackages                             yjballestero/yii2-phpmailer - 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. yjballestero/yii2-phpmailer

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

yjballestero/yii2-phpmailer
===========================

PHPMailer Adapter for Yii2

13071PHP

Since May 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/YJBallestero/yii2-phpmailer)[ Packagist](https://packagist.org/packages/yjballestero/yii2-phpmailer)[ RSS](/packages/yjballestero-yii2-phpmailer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHPMailer adapter for Yii2
==========================

[](#phpmailer-adapter-for-yii2)

Mail service for Yii2 using as transport [PHPMailer](https://github.com/PHPMailer/PHPMailer).

Unlike the standard SwiftMailer, it supports sending using the php mail function.

Requirements
------------

[](#requirements)

This library uses:

- PHP 8.0+.
- Yii2 2.0.39+

Install
-------

[](#install)

It is recommended that you install the PHP Browser library [through composer](http://getcomposer.org). To do so, run the following command:

```
composer require yjballestero/yii2-phpmailer
```

Or add this line into your `composer.json` file:

```
"yjballestero/yii2-phpmailer": "dev-master"
```

Setting
-------

[](#setting)

```
 $config = [
     'components' => [
        'mailer' => [
            'class' => yjballestero\phpmailer\PHPMailerMailer::class,
            // config \PHPMailer\PHPMailer\PHPMailer
            'transportConfig' => [
                'Mailer'     => 'smtp', //Send using SMTP
                'CharSet'    => CHARSET, //us-ascii, iso-8859-1, utf-8
                'Encoding'   => ENCODING, //7bit, 8bit, base64, binary, quoted-printable
                'Host'       => 'smtp.example.com', //Set the SMTP server to send through
                'Username'   => 'user@example.com', //SMTP username
                'Password'   => 'secret', //SMTP password
                'Port'       => MAIL_PORT, //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
                'SMTPSecure' => SMTP_ENCRYPT, //TLS, SSL
                'SMTPAuth'   => true, //Enable SMTP authentication
            ],

            // default message config
            'messageConfig' => [
                'from' => FROM
            ]
        ]
    ]
];
```

A Simple Example of Use
-----------------------

[](#a-simple-example-of-use)

```
public function sendEmail() {
    $to = 'test@example.com';
    $title = 'test';
    $subject = 'test email';
    $message = 'Hello world';

    $email = Yii::$app->mailer->compose(['content'=>$message, 'title'=>$title])
                              ->setTo($to)
                              ->setSubject($subject);
    if($email->send()){
        return 'Message has been sent';
    }
    return $email->mailer->adapter->ErrorInfo;
}
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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/2b47a628efd31e556867293e4ddbfd9a9f903d27da860e6298f842dccff7e386?d=identicon)[yjballestero](/maintainers/yjballestero)

---

Top Contributors

[![YJBallestero](https://avatars.githubusercontent.com/u/1728320?v=4)](https://github.com/YJBallestero "YJBallestero (2 commits)")

### Embed Badge

![Health badge](/badges/yjballestero-yii2-phpmailer/health.svg)

```
[![Health](https://phpackages.com/badges/yjballestero-yii2-phpmailer/health.svg)](https://phpackages.com/packages/yjballestero-yii2-phpmailer)
```

###  Alternatives

[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[eduardokum/laravel-mail-auto-embed

Library for embed images in emails automatically

1702.0M5](/packages/eduardokum-laravel-mail-auto-embed)

PHPackages © 2026

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