Skip to content

Commit

Permalink
[OD-382] Fix order of the around plugins to log messages even the ema…
Browse files Browse the repository at this point in the history
…il communication feature is disabled
  • Loading branch information
Mavlyan committed Jan 10, 2024
1 parent f7b4d29 commit 3093b98
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Mygento_Smtp module

Extends Magento_Email module.
The module adds a feature to log email messages to the database even when email sending is disabled.

## Admin panel
`Stores -> SMTP -> SMTP Log`: The grid with email logs

## Configuration
Add Yes/No field `Log Email` to `Stores -> Configuration -> Advanced -> System -> Mail Sending Settings`

## Plugins
* `aroundSendMessage`
* original class: `\Magento\Framework\Mail\TransportInterface`
* functionality: create Log record in DB

## How to use
1. Enable `Log Email` on the configuration page. It works independently from `Disable Email Communications` setting.
4 changes: 3 additions & 1 deletion etc/di.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\Mail\TransportInterface">
<plugin name="mygento_smtp" type="Mygento\Smtp\Mail\Transport" />
<plugin name="mygento_smtp" type="Mygento\Smtp\Mail\Transport" sortOrder="10"/>
<!-- Fix order of the core plugin in order to log messages even email communication is disabled -->
<plugin name="EmailDisable" type="Magento\Email\Model\Mail\TransportInterfacePlugin" sortOrder="20"/>
</type>

<!-- generated code -->
Expand Down

0 comments on commit 3093b98

Please sign in to comment.