PHPackages                             runner/gatling-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. [Mail &amp; Notifications](/categories/mail)
4. /
5. runner/gatling-mail

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

runner/gatling-mail
===================

v1.0.2(9y ago)42351MITPHPPHP &gt;=5.6

Since Jul 28Pushed 9y ago1 watchersCompare

[ Source](https://github.com/RunnerLee/gatling-mail)[ Packagist](https://packagist.org/packages/runner/gatling-mail)[ RSS](/packages/runner-gatling-mail/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

gatling-mail
============

[](#gatling-mail)

加特林机枪, 突突突突突突突突突

还是抄的

想法来源于laravel内置的邮件服务， 集成了sendcloud的发送驱动以及smtp的发送驱动。

smtp也是抄的，抄PHPMailer的。

### 安装

[](#安装)

```
composer -vvv require runner/gatling-mail

```

### 使用

[](#使用)

内置了支持简单替换变量的模板

例如，当使用 sendcloud 的普通发送或者 smtp 发送时，可以这么用：

```
(new Email())->content(function(Message $message) {
    $message->setName('test message')
            ->setContent('test content by {username}')
            ->setParameters([
                'username' => 'runnerlee',
            ]);
});

```

当使用 sendcloud 的模板发送时，则因为 `xsmtpapi` 字段的原因，需要把这么配置：

```

(new Email())->content(function(Message $message) {
    $message->setName('test message')
            ->setContent('test content by %username%')
            ->setDelimiter('%', '%')
            ->setParameters([
                'username' => ['runnerlee'],
            ]);
});

```

具体原因请参考 sendcloud 的接口文档

```

// 实例化发送驱动,
$sendcloud = new \Runner\GatlingMail\Drivers\SendCloudDriver([
    'api_user' => 'shuai',
    'api_key'  => 'bi',
]);

// 实例化发送器, 装入发送驱动,
$mailer = new \Runner\GatlingMail\Mailer($sendcloud);

// 实例化邮件, 类似于用客户端发送邮件时的新建邮件动作
$email = (new \Runner\GatlingMail\Email())
            ->subject('this is a test email')
            ->to('runnerleer@gmail.com')
            ->from('master@gov.cn', '收水费了')
            ->content(function(\Runner\GatlingMail\Message $message) {
                $message->setName('test message')
                        ->setContent('test content by %username%')
                        ->setDelimiter('%', '%')
                        ->setParameters([
                            'username' => 'runnerlee',
                        ]);
            })
            ->tag('10086')
            ->attach('address.txt', __DIR__ . '/address.txt');

// 装入邮件, biubiubiu
$mailer->setEmail($email)->send();

```

### 在 fastD(~1.4) 中使用

[](#在-fastd14-中使用)

##### 注册为辅助服务

[](#注册为辅助服务)

`# app/Application.php`

```
public function registerService()
{
    // 配置发送驱动
    $sendCloud = new \Runner\GatlingMail\Drivers\SendCloudDriver([
        'api_user' => '',
        'api_key'  => '',
    ]);
    $email = (new \Runner\GatlingMail\Email())->from('contact@runnerlee.com', 'runnerlee');
    return [
        'mailer' => (new \Runner\GatlingMail\Mailer($sendCloud)),
    ];
}

```

`# src/DemoBundle/Events/Demo.php`

```

public function indexAction()
{
    $this->get('mailer')
         ->getEmail()
         ->to('runnerleer@gmail.com')
         ->content(function(\Runner\GatlingMail\Message $message) {
             $message->setName('test message')
                 ->setContent('test content by {username}')
                 ->setParameters([
                     'username' => 'runnerlee',
                 ]);
         })
         ->subject('this is a test email');

    $this->get('mailer')->send();
}

```

### 参考

[](#参考)

### TODO

[](#todo)

- 限制附件大小
- 优化调用

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~97 days

Total

3

Last Release

3423d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15872de2a16678788e3008d3874fbffe0b136088bca5ae96974189a357f99222?d=identicon)[RunnerLee](/maintainers/RunnerLee)

---

Top Contributors

[![RunnerLee](https://avatars.githubusercontent.com/u/7436388?v=4)](https://github.com/RunnerLee "RunnerLee (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mattketmo/email-checker

Throwaway email detection library

2752.1M5](/packages/mattketmo-email-checker)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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