PHPackages                             pluswerk/mail-logger - 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. pluswerk/mail-logger

ActiveTypo3-cms-extension[Mail &amp; Notifications](/categories/mail)

pluswerk/mail-logger
====================

Mail Logger by anders und sehr GmbH

5.0.5(2mo ago)753.5k↓32.7%8[1 issues](https://github.com/andersundsehr/mail_logger/issues)[1 PRs](https://github.com/andersundsehr/mail_logger/pulls)GPL-2.0-or-laterPHPPHP ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Feb 16Pushed 2mo ago8 watchersCompare

[ Source](https://github.com/andersundsehr/mail_logger)[ Packagist](https://packagist.org/packages/pluswerk/mail-logger)[ Docs](https://www.andersundsehr.com/)[ RSS](/packages/pluswerk-mail-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (55)Used By (0)

[![Packagist Release](https://camo.githubusercontent.com/750ec4eda3968ec360dd5fe8b0c71979b4f4e32d20ac448dd73eaac055e76f74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706c75737765726b2f6d61696c2d6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pluswerk/mail-logger)[![GitHub License](https://camo.githubusercontent.com/0359d1a9c28cc0e9b4aeb91c9b1fa9b455f197652d6c73416b1a7b2d2bf2029f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616e64657273756e64736568722f6d61696c5f6c6f676765722e7376673f7374796c653d666c61742d737175617265)](https://github.com/andersundsehr/mail_logger/blob/master/LICENSE.txt)

EXT:mail\_logger by anders und sehr GmbH
========================================

[](#extmail_logger-by-anders-und-sehr-gmbh)

This is an TYPO3 extension with some mail functions:

1. [E-mail logging](#1-e-mail-logging)
2. [E-mail templates](#2-e-mail-templates)

Extension installation
----------------------

[](#extension-installation)

Install via composer or just copy the files into the TYPO3 extension folder:

```
composer require pluswerk/mail-logger
```

Add the Typoscript files to your sites Typoscript:

- add `@import 'EXT:mail_logger/Configuration/TypoScript/constants.typoscript'` in your constants
- and `@import 'EXT:mail_logger/Configuration/TypoScript/setup.typoscript'` in your setup.

1. E-mail logging
-----------------

[](#1-e-mail-logging)

The extension automatically log all outgoing mails of the TYPO3 system, which are sent via the TYPO3 mail API. Just install the extension and it works. All outgoing mails can be found in the backend module of this TYPO3 mail logger.

By default the maximum logging time of e-mails is 30 days and can be changed as following: [see strtotime](http://php.net/manual/en/function.strtotime.php#refsect1-function.strtotime-examples)The mails will be anonymized after 7 days by default. It can be changed to anonymize directly, by setting anonymizeAfter to 0.

```
module.tx_maillogger.settings.cleanup {
  lifetime = 30 days
  anonymize = 1
  anonymizeAfter = 7 days
}
```

2. E-mail templates
-------------------

[](#2-e-mail-templates)

You can configure TYPO3 e-mail templates, written in Fluid, which are editable from editors (in the database) and configured via TypoScript (in VCS).

*How does this work?*E-mails will be basically configured in a TypoScript configuration (configuration of the sender address for example). Afterwards a database entry will be generated from the editor, which extends this template with additional information (fluid template or receiver for example). The instance of such an e-mail can be extended or overridden afterwards via php in your own extension (for example: dynamic receiver).

### TypoScript example

[](#typoscript-example)

You always have to create a TypoScript template for a mail. The "label" is the only required field, the orher fields are optional.

```
# E-mail template
module.tx_maillogger.settings.mailTemplates {
    exampleMailTemplateKey {
        label = This Label will be shown in the Backend for BE-Users, replace this with a good title! :-)
        mailFromName = Default Mail-From-Name
        mailFromAddress = info@domain.com
        mailToNames = Markus Hoelzle, John Doe
        mailToAddresses = markus-hoelzle@example.com, john.doe@example.com
        mailBlindCopyAddresses = we-read-all-your-mails@example.com
    }
}

```

### E-mail templates in database

[](#e-mail-templates-in-database)

E-mail templates will be stored in the database. Just create a record "E-mail template". The TypoScript template will be selected there. The message will be rendered by Fluid, so it is possible to print variables or use ViewHelpers.

##### Example message:

[](#example-message)

```

  Hello,

  we have {amount} new purchase keys (see attachment).

  This mail was sent automatically by domain.com

```

### sending E-mails via PHP

[](#sending-e-mails-via-php)

E-mail instances "\\Pluswerk\\MailLogger\\Domain\\Model\\Mail\\TemplateBasedMailMessage" inherit from SwiftMailer class "\\Swift\_Message". Therefor an e-mail instance have got following functions: The easiest way is to use the functions of the "\\Pluswerk\\MailLogger\\Utility\\MailUtility" class.

##### basic sample:

[](#basic-sample)

```
