PHPackages                             magematch/magento2-sales-email-attachments - 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. magematch/magento2-sales-email-attachments

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

magematch/magento2-sales-email-attachments
==========================================

Magento 2 module that automatically appends PDF invoices, shipments, credit memos, and policy documents to outgoing sales transactional emails.

v1.0.1(1mo ago)00MITPHPPHP &gt;=8.1CI passing

Since Apr 16Pushed 1mo agoCompare

[ Source](https://github.com/magematch/magento2-sales-email-attachments)[ Packagist](https://packagist.org/packages/magematch/magento2-sales-email-attachments)[ Docs](https://magematch.com)[ RSS](/packages/magematch-magento2-sales-email-attachments/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Sales Email Attachments for Magento 2
=====================================

[](#sales-email-attachments-for-magento-2)

> Free, open-source Magento 2 extension
> by **Arjun Dhiman** — [Adobe Commerce Certified Master](https://magematch.com/developers/arjun-dhiman)
> Part of the [MageMatch](https://magematch.com)developer ecosystem

`MageMatch_SalesEmailAttachments` automatically appends PDF documents and policy files to Magento sales transactional emails — no custom email template edits required.

Features
--------

[](#features)

- Auto-attaches PDF renditions of invoices, shipments, and credit memos to the matching transactional email.
- Attaches a configurable Terms &amp; Conditions or policy document (PDF, DOC, DOCX, TXT) to selected email types.
- Supports CC and BCC fields for all outgoing sales emails.
- Enable/disable each attachment type independently from the admin panel.
- Built with `declare(strict_types=1)`, constructor property promotion, and a clean `match` expression — no legacy Zend 1 code.
- Compatible with Magento 2.4.4+ and PHP 8.1 through 8.4.

Troubleshooting: duplicate module registration
----------------------------------------------

[](#troubleshooting-duplicate-module-registration)

If you see an error like:

`Module 'MageMatch_SalesEmailAttachments' ... has been already defined in 'vendor/...'.`

it means Magento found the same module in both locations:

- `app/code/MageMatch/SalesEmailAttachments`
- `vendor/magematch/magento2-sales-email-attachments`

Fix (Composer-based install):

```
rm -rf app/code/MageMatch/SalesEmailAttachments
composer install
php bin/magento setup:upgrade
php bin/magento cache:flush
```

Verify only one copy remains:

```
test -d app/code/MageMatch/SalesEmailAttachments && echo "app/code present" || echo "app/code missing"
test -d vendor/magematch/magento2-sales-email-attachments && echo "vendor present" || echo "vendor missing"
```

Configuration
-------------

[](#configuration)

In admin, go to:

`Stores > Configuration > MageMatch Extensions > Sales Email Attachments`

### PDF Attachments

[](#pdf-attachments)

FieldDescription**Attach Sales PDF to Email**Enable/disable auto PDF attachment.**Attach PDF For**Choose one or more: Invoice, Shipment, Credit Memo.### Terms &amp; Conditions

[](#terms--conditions)

FieldDescription**Attach Terms &amp; Conditions**Enable/disable the policy document attachment.**Attach Terms &amp; Conditions For**Choose email types: Order, Invoice, Shipment, Credit Memo.**Terms &amp; Conditions File**Upload a `.pdf`, `.doc`, `.docx`, or `.txt` file.### CC / BCC

[](#cc--bcc)

FieldDescription**CC Email Address(es)**Comma-separated addresses added to every sales email.**BCC Email Address(es)**Comma-separated addresses added to every sales email.How it works
------------

[](#how-it-works)

The module overrides two Magento core classes via `di.xml` preferences:

- `Magento\Sales\Model\Order\Email\SenderBuilder` → `MageMatch\SalesEmailAttachments\Mail\SenderBuilder`Intercepts `configureEmailTemplate()` to append attachments before the email is sent.
- `Magento\Framework\Mail\Template\TransportBuilder` → `MageMatch\SalesEmailAttachments\Mail\Template\TransportBuilder`Adds the `addAttachment()` method used by `SenderBuilder`.

Module Structure
----------------

[](#module-structure)

```
Helper/Data.php                          Config value accessor
Mail/SenderBuilder.php                   Attachment injection logic
Mail/Template/TransportBuilder.php       addAttachment() support
Model/Config/Backend/TacFile.php         File upload backend model
Model/Config/Source/AttachPdfIn.php      PDF email type source
Model/Config/Source/AttachTermsConditions.php  T&C email type source
etc/adminhtml/system.xml                 Admin config fields
etc/acl.xml                              ACL resource
etc/config.xml                           Default config values
etc/di.xml                               Class preference wires
view/adminhtml/requirejs-config.js       Mixin registration
view/adminhtml/web/js/store-config/
  validator-rules-mixin.js               Client-side file-type validation

```

CI Matrix
---------

[](#ci-matrix)

This repository includes a GitHub Actions workflow at `.github/workflows/ci.yml`.

Validation runs on:

- PHP `8.2`
- PHP `8.4`

It validates Composer metadata, PHP syntax, and XML well-formedness.

### Install commands by environment

[](#install-commands-by-environment)

Stable production install:

```
composer require magematch/magento2-sales-email-attachments:^1.0
```

Staging/dev install (before first stable tag is visible on Packagist):

```
composer require magematch/magento2-sales-email-attachments:"dev-main@dev"
```

---

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

[](#installation)

```
composer require magematch/magento2-sales-email-attachments
bin/magento module:enable MageMatch_SalesEmailAttachments
bin/magento setup:upgrade
bin/magento cache:clean
```

Compatibility
-------------

[](#compatibility)

- Magento Open Source 2.4.x
- Adobe Commerce 2.4.x
- PHP 8.1, 8.2, 8.3

Support &amp; Custom Development
--------------------------------

[](#support--custom-development)

Need custom Magento development?
Find vetted Adobe Commerce developers at
**[magematch.com](https://magematch.com)**

License
-------

[](#license)

MIT License — free to use commercially

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance91

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~9 days

Total

2

Last Release

45d ago

PHP version history (2 changes)v1.0.0PHP ^8.1 || ^8.2 || ^8.3 || ^8.4

v1.0.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/25de70104e0bb9357f7dc83de70315741d4b04931f7104e96f48e0b0e7b32ee8?d=identicon)[arjundhi](/maintainers/arjundhi)

---

Top Contributors

[![aiopsgroup](https://avatars.githubusercontent.com/u/131590932?v=4)](https://github.com/aiopsgroup "aiopsgroup (8 commits)")

### Embed Badge

![Health badge](/badges/magematch-magento2-sales-email-attachments/health.svg)

```
[![Health](https://phpackages.com/badges/magematch-magento2-sales-email-attachments/health.svg)](https://phpackages.com/packages/magematch-magento2-sales-email-attachments)
```

###  Alternatives

[magepal/magento2-gmailsmtpapp

Magento 2 SMTP Extension - Configure Magento 2 to send all transactional email using Gmail, G Suite, Amazon SES, Office360, Mailgun, SendGrid, Mandrill or any other SMTP servers

3271.9M2](/packages/magepal-magento2-gmailsmtpapp)[mailchimp/mc-magento2

Connect MailChimp with Magento

1591.9M3](/packages/mailchimp-mc-magento2)[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50390.4k20](/packages/dotdigital-dotdigital-magento2-extension)[magepal/magento2-edit-order-email

Magento 2 edit order email

33298.9k](/packages/magepal-magento2-edit-order-email)[fooman/emailattachments-m2

Automatically attach pdf and terms and conditions documents to outgoing sales emails.

23541.6k](/packages/fooman-emailattachments-m2)[fooman/emailattachments-implementation-m2

Automatically attach pdf and terms and conditions documents to outgoing sales emails.

14914.9k5](/packages/fooman-emailattachments-implementation-m2)

PHPackages © 2026

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