PHPackages                             filips123/monolog-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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. filips123/monolog-phpmailer

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

filips123/monolog-phpmailer
===========================

PHPMailer handler for Monolog

v2.0.0(2y ago)1365.6k—0.5%32MITPHPPHP &gt;= 8.1

Since Sep 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/filips123/MonologPHPMailer)[ Packagist](https://packagist.org/packages/filips123/monolog-phpmailer)[ Docs](https://github.com/filips123/MonologPHPMailer/)[ Fund](https://buymeacoff.ee/filips)[ Fund](https://donorbox.org/filips)[ RSS](/packages/filips123-monolog-phpmailer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (6)Used By (2)

MonologPHPMailer
================

[](#monologphpmailer)

[![version](https://camo.githubusercontent.com/ed1ed4a4258e78f46b60d6115772adb769508484dadc04dd825835dff9de166f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66696c6970733132332f6d6f6e6f6c6f672d7068706d61696c65722e7376673f7374796c653d666c61742d737175617265266c6162656c3d76657273696f6e)](https://packagist.org/packages/filips123/monolog-phpmailer/)[![downloads](https://camo.githubusercontent.com/c81978a186487563d89a06e93022e522205e9938e54dd59b31024853a52cc479/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66696c6970733132332f6d6f6e6f6c6f672d7068706d61696c65722e7376673f7374796c653d666c61742d737175617265266c6162656c3d646f776e6c6f616473)](https://packagist.org/packages/filips123/monolog-phpmailer/)[![license](https://camo.githubusercontent.com/b7c28d63f43c7a891c18b88d64992184c8ec4411f154a0afcf9c5b7c9f738086/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66696c6970733132332f6d6f6e6f6c6f672d7068706d61696c65722e7376673f7374796c653d666c61742d737175617265266c6162656c3d6c6963656e7365)](https://choosealicense.com/licenses/mit/)[![php](https://camo.githubusercontent.com/ddf7d2e4a55a7c5842edf87f5f13aca28945107e8f38aab9e744d1076c40864d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f66696c6970733132332f6d6f6e6f6c6f672d7068706d61696c65722e7376673f7374796c653d666c61742d737175617265266c6162656c3d706870)](https://php.net/)[![build](https://camo.githubusercontent.com/35a5ba456d666c3f4d6174f2352d2965d797d4a35e734f503d4310bfab03263b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f66696c6970733132332f4d6f6e6f6c6f675048504d61696c65722f6d61696e2e796d6c3f7374796c653d666c61742d737175617265266c6162656c3d6275696c64)](https://github.com/filips123/MonologPHPMailer/actions)[![coverage](https://camo.githubusercontent.com/d5c85318eaa6e8f4945a2d274cb57e69baa1cbf5d4a269585adeb83ad388ddbb/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f66696c6970733132332f4d6f6e6f6c6f675048504d61696c65722e7376673f7374796c653d666c61742d737175617265266c6162656c3d636f766572616765)](https://scrutinizer-ci.com/g/filips123/MonologPHPMailer/code-structure/)[![quality](https://camo.githubusercontent.com/daf7387b2f2c39db406eb7854fabc282a1a3fb86ed74e5962a815436d99df5c2/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f66696c6970733132332f4d6f6e6f6c6f675048504d61696c65722e7376673f7374796c653d666c61742d737175617265266c6162656c3d7175616c697479)](https://scrutinizer-ci.com/g/filips123/MonologPHPMailer/)

MonologPHPMailer is a [PHPMailer](https://github.com/PHPMailer/PHPMailer/) handler for [Monolog](https://github.com/Seldaek/monolog/). It enables you to send logs to emails with PHPMailer.

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

[](#installation)

### Requirements

[](#requirements)

MonologPHPMailer requires [PHP](https://php.net/) 8.1 or higher, [Monolog](https://github.com/Seldaek/monolog/) 3.x, and [PHPMailer](https://github.com/PHPMailer/PHPMailer/) 6.x.

### Using Composer

[](#using-composer)

The recommended way to install MonologPHPMailer is with [Composer](https://getcomposer.org/), a dependency manager for PHP.

You should just add `filips123/monolog-phpmailer` to your project dependencies in `composer.json`. It will also install Monolog and PHPMailer, but it is recommended to add them manually to `composer.json`.

```
{
    "require": {
        "monolog/monolog": "^3.0",
        "phpmailer/phpmailer": "^6.0",
        "filips123/monolog-phpmailer": "^2.0"
    }
}
```

Do not forget to run `composer install` and add `require 'vendor/autoload.php';` to your main script.

### Manually Installation

[](#manually-installation)

Alternatively, you could download all files in the [`src`](https://github.com/filips123/MonologPHPMailer/tree/master/src) directory from GitHub and then manually include them in your script. You also have to install Monolog and PHPMailer manually.

Usage
-----

[](#usage)

You should just add the handler `MonologPHPMailer\PHPMailerHandler` to your logger. Its first argument must be a PHPMailer instance.

Example
-------

[](#example)

```
