PHPackages                             agrandesr/php-mailer-action - 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. agrandesr/php-mailer-action

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

agrandesr/php-mailer-action
===========================

This Custom Actions is a implementation of the PHPMailerpackage over Agile Router to send emails in a very easy way using the Custom Actions of Agile Router.

v0.2(3y ago)09MITPHP

Since Feb 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/AGrandesR/PHPMailerAction)[ Packagist](https://packagist.org/packages/agrandesr/php-mailer-action)[ RSS](/packages/agrandesr-php-mailer-action/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

PHPMailerAction
===============

[](#phpmaileraction)

*This package is an extension of Agrandesr/agile-router (v1.0+).*

This Custom Actions is a implementation of the [PHPMailer](https://github.com/PHPMailer/PHPMailer) package over Agile Router to send emails in a very easy way using the Custom Actions of Agile Router.

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

[](#installation)

First we need to require the package:

```
composer require agrandesr/php-mailer-action
```

Next, we need to add to the Router before the run method.

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

use Agrandesr\Router;

$router = new Router();

$router->addCustomAction('mail','App\\CustomActions\\PhpMailerAction');

$router->run();
```

Next you have to modify .env file with your mail server data:

```
MAIL_HOST=domain.mail.example
MAIL_PORT=587
MAIL_USERNAME=no-reply@test.com
MAIL_PASSWORD=*******************
#MAIL_SECURITY=TLS
MAIL_SENDNAME=EmailTest
```

Now you can use the new action in your routes file.

```
{
    "mail":{
        "GET":{
            "execute":[
                {
                    "type":"mail",
                    "content":{
                        "addAddress":"example@test.com",
                        "addCC":"exampleCC@test.com",
                        "addBCC":"exampleBCC@test.com",
                        "addAttachment":[["src/file/image.png","ImageName.png"]],
                        "body":"src/template/mail.html",
                        "altBody":"No worries, was only a test"
                    }
                }
            ]
        }
    }
}
```

And that is all, you can create a endpoint to send a email very easy.

Content parameters
------------------

[](#content-parameters)

Like you can see in the example, the action "PhpMailer" have the next parameters:

- addAddress\['required'\]:
- addCC\['optional'\]:
- addBCC\['optional'\]:
- addAttachment\['optional'\]:
- body\['optional'\]: You can add a source direction like "src/template.html" or write directly the html code.
- altBody\['optional'\]:
- envFlag: You can add a flag to change the env variable key name to allow more than one mail server.

ENV variables
-------------

[](#env-variables)

You can have more than one mail server setted for one project using envFlag. The envFlag adds the value of the endFlag in the middle of your envFlag key. For example:

```
{
    "mail":{
        "GET":{
            "execute":[
                {
                    "type":"mail",
                    "content":{
                        "envFlag":"CALIFORNIA"
                        "addAddress":"california@test.com",
                        "body":"src/template/mail.html"
                    }
                },
                {
                    "type":"mail",
                    "content":{
                        "envFlag":"TEXAS"
                        "addAddress":"texas@test.com",
                        "body":"src/template/mail.html"
                    }
                }
            ]
        }
    }
}
```

For the last example you have to complete other env variables:

```
MAIL_CALIFORNIA_HOST=domain.mail.example
MAIL_CALIFORNIA_PORT=587
MAIL_CALIFORNIA_USERNAME=no-reply@test.com
MAIL_CALIFORNIA_PASSWORD=*******************
MAIL_CALIFORNIA_SENDNAME=EmailTest

MAIL_TEXAS_HOST=domain.mail.example
MAIL_TEXAS_PORT=587
MAIL_TEXAS_USERNAME=no-reply@test.com
MAIL_TEXAS_PASSWORD=*******************
MAIL_TEXAS_SENDNAME=EmailTest
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1224d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/61379065?v=4)[A.Grandes.R](/maintainers/AGrandesR)[@AGrandesR](https://github.com/AGrandesR)

---

Top Contributors

[![AGrandesR](https://avatars.githubusercontent.com/u/61379065?v=4)](https://github.com/AGrandesR "AGrandesR (3 commits)")

### Embed Badge

![Health badge](/badges/agrandesr-php-mailer-action/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[getkirby/cms

The Kirby core

1.5k584.8k470](/packages/getkirby-cms)[ivantcholakov/codeigniter-phpmailer

A CodeIgniter 3 compatible email-library powered by PHPMailer.

25214.3k](/packages/ivantcholakov-codeigniter-phpmailer)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[sproutcms/cms

Enterprise content management and framework

242.5k4](/packages/sproutcms-cms)

PHPackages © 2026

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