maisondunet/module-email-attachment

Add invoice / shipment / creditmemo and custom attachments files to magento sales emails

Installs: 1 526

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Type:magento2-module

v1.0.5 2023-02-22 09:36 UTC

This package is auto-updated.

Last update: 2024-11-22 13:20:51 UTC


README

This module Open-source module allow the administrator to attach Invoice, Shipment, Credit Memo and Custom PDF Files to sales email notification. It has been design to be as simple, expendable and as unobtrusive as possible.

It doesn't contain any bloatware just the bare minimum.

Compatibility

The module has been tested with Magento 2.4.5, it should work with any 2.4.* magento installation.

Installation

To install the Magento 2 GTM Cookie consent, simply run the command below:

composer require maisondunet/module-email-attachment

To enable the module:

bin/magento module:enable Maisondunet_EmailAttachment

Module configuration

Module configuration is located at :

Stores > Configuration > Sales > Sales Emails

Invoice Options

Shipment Options

Credit Memo Options

Email Attachments Options

This functionality allow the administrator to attach custom Files to sales-emails.

Extensibility

Create a class to handle you custom attachment

class CreditMemo implements AttachmentResolverInterface
{
    // --------
    
    /**
    * @param Template $template
    * @return MimePartInterface[]
     */
    public function getAttachments(Template $template): array{
        // Build your custom attachment there
    }
}

And register to service inside a di.xml

<?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="Maisondunet\EmailAttachment\Model\AttachmentResolverPool">
        <arguments>
            <argument name="attachmentResolvers" xsi:type="array">
                <item name="credit_memo" xsi:type="object">Maisondunet\EmailAttachment\Model\AttachmentResolver\SystemConfiguration</item>
            </argument>
        </arguments>
    </type>
</config>