PHPackages                             baywa-re-lusy/email - 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. baywa-re-lusy/email

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

baywa-re-lusy/email
===================

BayWa r.e. LUSY Email Tools

2.2.2(1y ago)0646proprietaryPHPPHP &gt;= 8.1

Since Oct 13Pushed 1y agoCompare

[ Source](https://github.com/baywa-re-lusy/email)[ Packagist](https://packagist.org/packages/baywa-re-lusy/email)[ Docs](https://github.com/baywa-re-lusy/email)[ RSS](/packages/baywa-re-lusy-email/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (19)Used By (0)

BayWa r.e. Email Tools
======================

[](#baywa-re-email-tools)

[![CircleCI](https://camo.githubusercontent.com/b4c90a292c84fef9b76d644cc427acd1bf41cf2f4ac1ffc7e7816c9a15140dba/68747470733a2f2f636972636c6563692e636f6d2f67682f62617977612d72652d6c7573792f656d61696c2f747265652f6d61696e2e7376673f7374796c653d737667)](https://circleci.com/gh/baywa-re-lusy/email/tree/main)

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

[](#installation)

To install the Email tools, you will need [Composer](http://getcomposer.org/) in your project:

```
composer require baywa-re-lusy/email
```

Usage
-----

[](#usage)

Currently, this library supports MailGun and SendGrid.

### MailGun

[](#mailgun)

```
use BayWaReLusy\Email\Adapter\MailgunAdapter;
use BayWaReLusy\Email\EmailService;

$adapter      = new MailgunAdapter('mailgun-api-key', 'mailgun-domain', 'https://api.eu.mailgun.net/');
$emailService = new EmailService($adapter);
```

### AWS SES

[](#aws-ses)

```
use BayWaReLusy\Email\Adapter\AwsAdapter;
use BayWaReLusy\Email\EmailService;

$adapter      = new AwsAdapter('aws-key', 'aws-secret', 'aws-region', 'domain');
$emailService = new EmailService($adapter);
```

Tests
-----

[](#tests)

The avoid sending emails during acceptance tests, but to still test that emails are sent, there is a mock EmailService (which inherits from the real EmailService) and an Email context.

To use the mock EmailService, you can replace the original EmailService in testing mode (e.g. in `Module.php`) :

```
if (getenv('ENV') === 'testing') {
    $config->merge(new Config(include __DIR__ . '/../../../tests/mocks.config.php'));
}
```

And in `mocks.config.php` :

```
