Log in
Model

TransportInterfacePlugin

Magento\Email\Model\Mail\TransportInterfacePlugin

What it does

This plugin intercepts email sending in Magento 2 and conditionally disables it based on the system configuration.

Developers use this when they need to prevent emails from being sent (e.g., in development/staging environments) by setting the 'system/smtp/disable' configuration flag.

It wraps around the TransportInterface::sendMessage() method to check if email sending is disabled before allowing the email to be sent.

Public Methods

  • aroundSendMessage()