PHPackages                             wieni/wmmailable - 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. wieni/wmmailable

ActiveDrupal-module[Mail &amp; Notifications](/categories/mail)

wieni/wmmailable
================

A modern, plugin-based API for sending mails in Drupal 8.

2.5.0(11mo ago)019.3k↓39.4%2[6 issues](https://github.com/wieni/wmmailable/issues)MITPHPPHP &gt;=7.1.0CI failing

Since Nov 19Pushed 11mo ago4 watchersCompare

[ Source](https://github.com/wieni/wmmailable)[ Packagist](https://packagist.org/packages/wieni/wmmailable)[ RSS](/packages/wieni-wmmailable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (36)Used By (0)

wmmailable
==========

[](#wmmailable)

[![Latest Stable Version](https://camo.githubusercontent.com/0ef999c29383ba4e50e4691317a268b60c7ca861ac9e38adb25228fd6d66f2c1/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d6d61696c61626c652f762f737461626c65)](https://packagist.org/packages/wieni/wmmailable)[![Total Downloads](https://camo.githubusercontent.com/20754a0b0f9075ca1bce862634a4ae82f1978218f4577819148af98f40b62247/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d6d61696c61626c652f646f776e6c6f616473)](https://packagist.org/packages/wieni/wmmailable)[![License](https://camo.githubusercontent.com/bff940de530aabaf020058a7f432a01edb6af4d1245d251c5e2a79a50bda8f6c/68747470733a2f2f706f7365722e707567782e6f72672f7769656e692f776d6d61696c61626c652f6c6963656e7365)](https://packagist.org/packages/wieni/wmmailable)

> A modern, plugin-based API for sending mails in Drupal 8. Inspired by [Laravel](https://laravel.com/docs/5.7/mail)

Why?
----

[](#why)

- No 'modern' way to handle mails in Drupal 8: messing with `hook_mail` and `hook_theme` does not really fit in the Wieni Drupal flow with [wmmodel](https://github.com/wieni/wmmodel), [wmcontroller](https://github.com/wieni/wmcontroller), etc.
- No clean, object-oriented API, e.g. to add CC / BCC-adresses you have to manually add headers
- Not intuitive, logic is scattered across multiple files, tends to get messy

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

[](#installation)

This package requires PHP 7.1 and Drupal 8 or higher. It can be installed using Composer:

```
 composer require wieni/wmmailable
```

How does it work?
-----------------

[](#how-does-it-work)

### Building mails

[](#building-mails)

- Mails are annotated plugins
- Each class represents one mail
- Dependency injection is possible by implementing the `ContainerFactoryPluginInterface` ([tutorial](https://chromatichq.com/blog/dependency-injection-drupal-8-plugins))

```
