PHPackages                             shockwavemk/magento2-module-mail - 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. shockwavemk/magento2-module-mail

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

shockwavemk/magento2-module-mail
================================

Base module for extending Magento2 mail features

v1.1.2(8y ago)101.8k52Apache-2.0PHP

Since May 16Pushed 8y ago2 watchersCompare

[ Source](https://github.com/shockwavemk/magento2-module-mail)[ Packagist](https://packagist.org/packages/shockwavemk/magento2-module-mail)[ RSS](/packages/shockwavemk-magento2-module-mail/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelogDependenciesVersions (22)Used By (2)

Magento 2 enhanced mailing module
=================================

[](#magento-2-enhanced-mailing-module)

This module enhances the magento 2 capabilities to send transactional mails. In a plain magento 2 installation it is neither possible to track and manage transactional emails sent by magento 2 system, nor it is possible to store mails locally or at backup service providers.

This mailing module distinguishes between parts of email processing:

- A mail transport system which takes care of transport of outgoing mails to a mail service provider and retrieval of returning meta data for mails entities.
- A mail storeage system which takes care of storing the data of outgoing mails and its metadata on file-systems.

As well the implemented transport system as the storeage system consist of a configurable base class for Magento 2 and a second class for dynamic loaded plugin classes which performs the actual transport. Therefore it is possible to keep the rich basic functionality of this mail module and to enhance it by vendor specific functionality.

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

[](#installation)

Add the module to your composer file.

```
{
  "require": {
    "shockwavemk/magento2-module-mail": "dev-master"
  }
}
```

Install the module with composer.

```
    composer update
```

On succeed, install the module via bin/magento console.

```
    bin/magento cache:clean

    bin/magento module:enable Shockwavemk_Mail_Base

    bin/magento setup:upgrade
```

Features
--------

[](#features)

### Mail sending over configurable plugins

[](#mail-sending-over-configurable-plugins)

Transport and storeage configuration can be easily done via store config. Installed plug-ins for transport and storeage can be selected at this point.

[![](./docs/magento2-config-mail-enhancement.png)](./docs/magento2-config-mail-enhancement.png)

Supported vendors (so far):

Transport:

- Any SMTP server
- Mailgun

Storage:

- Local server storeage
- Dropbox

### Storeage of mail meta data in database

[](#storeage-of-mail-meta-data-in-database)

### Storeage of mail data as json files

[](#storeage-of-mail-data-as-json-files)

Each mail sent by magento 2 is stored individual as json file.

[![](./docs/magento2-mail-stored-as-json.png)](./docs/magento2-mail-stored-as-json.png)

Additional a rendered version of each mail is stored as .hmtl file. This reduces loading times on review and enables external storeage systems to preview content stored.

The default storeage stores all files sent by magento2 in a so called "spool" folder. The mail data will stay at this local server path until it is deleted or moved.

[![](./docs/local-storeage-for-mails-as-json.png)](./docs/local-storeage-for-mails-as-json.png)

With an installed storeage plugin a cronjob will automatically take care to move all stored mails to your secure external storeage location. Even if your server is reinstalled or you have to clean up your magento installation: The conversation with you customers is safe.

### Enhanced admin customer management by transactional mail review

[](#enhanced-admin-customer-management-by-transactional-mail-review)

The customer administration is enhanced by an additional menu tab.

Select customer in main admin menu:

[![](./docs/magento2-customer-menu.png)](./docs/magento2-customer-menu.png)

The marketing - user content - tab is enhanced by an additional menu point. On this new section you can review and resend all (guest and customer) mails sent by the magento2 system.

[![](./docs/magento2-guest-email-review-and-resending.jpg)](./docs/magento2-guest-email-review-and-resending.jpg)

### Re-Sending of transactional mails. Re-Calculated or Re-Sending of stored mail data

[](#re-sending-of-transactional-mails-re-calculated-or-re-sending-of-stored-mail-data)

This extension keeps track of each email sent from store. For each of them it is possible to trigger an resending.

[![](./docs/magento2-mail-resending-and-recalculation.png)](./docs/magento2-mail-resending-and-recalculation.png)

### Attachment handling and storeage of sent files

[](#attachment-handling-and-storeage-of-sent-files)

The base mail module supports attachment sending. Magento2 does not support native file attachment handling, therefore you need to add some code on your own.

In order to add files from filesystem, you need to change your email sending strategy to "async".

You have to modify/override the EmailSenderHandler class.

```
    /**
         * @param \Magento\Sales\Model\Order\Email\Sender                          $emailSender
         * @param \Magento\Sales\Model\ResourceModel\EntityAbstract                $entityResource
         * @param \Magento\Sales\Model\ResourceModel\Collection\AbstractCollection $entityCollection
         * @param \Magento\Framework\App\Config\ScopeConfigInterface               $globalConfig
         * @param Config                                                           $documentConfig
         * @param ObjectManagerInterface                                           $objectManager
         */
        public function __construct(
            \Magento\Sales\Model\Order\Email\Sender $emailSender,
            \Magento\Sales\Model\ResourceModel\EntityAbstract $entityResource,
            \Magento\Sales\Model\ResourceModel\Collection\AbstractCollection $entityCollection,
            \Magento\Framework\App\Config\ScopeConfigInterface $globalConfig,
            ObjectManagerInterface $objectManager
        )
        {
            parent::__construct($emailSender, $entityResource, $entityCollection, $globalConfig);

            $this->objectManager = $objectManager;
            $this->documentConfig = $documentConfig;

            // Dynamic typed build a collection for attachments for later usage

            // Should be extended from \Magento\Framework\Data\Collection
            $this->attachmentCollection = $this->objectManager->get(
                'Shockwavemk\Mail\Base\Model\Mail\AttachmentCollectionInterface'
            );
        }

    /**
     * Handles asynchronous email sending
     *
     * @return void
     * @throws \RuntimeException
     * @throws \Exception
     */
    public function sendEmails()
    {
        /** @var \Magento\Sales\Model\AbstractModel $item */
        foreach ($this->entityCollection->getItems() as $item) {

        // add this code

            // Create a new attachment

            if (!is_null($attachmentFilePath)) {
                /** @var \Shockwavemk\Mail\Base\Model\Mail\AttachmentInterface|\Magento\Framework\DataObject $attachment */
                $attachment = $this->objectManager
                    ->create('Shockwavemk\Mail\Base\Model\Mail\AttachmentInterface');

                // Do not transfer binary data to mail entity at this point: The mailer can handle file reading on its own
                $attachment->setFilePath($attachmentFilePath);

                // Add attachment to attachment collection
                // Let the mailer later decide how to handle them
                $this->attachmentCollection->addItem($attachment);
            }

        }

    }
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~116 days

Total

16

Last Release

3072d ago

Major Versions

v0.3.3 → v1.0.02016-08-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/54c742e6d9d3469ccc6b7436628251cb489f61138a5312d1b91dd6c34b500a88?d=identicon)[shockwavemk](/maintainers/shockwavemk)

---

Top Contributors

[![shockwavemk](https://avatars.githubusercontent.com/u/1316855?v=4)](https://github.com/shockwavemk "shockwavemk (74 commits)")[![d-gerken](https://avatars.githubusercontent.com/u/19686822?v=4)](https://github.com/d-gerken "d-gerken (2 commits)")

---

Tags

attachmentmagento2magento2-extensionmagento2-modulemailmailgun

### Embed Badge

![Health badge](/badges/shockwavemk-magento2-module-mail/health.svg)

```
[![Health](https://phpackages.com/badges/shockwavemk-magento2-module-mail/health.svg)](https://phpackages.com/packages/shockwavemk-magento2-module-mail)
```

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
