PHPackages                             select-co/module-email-sender - 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. select-co/module-email-sender

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

select-co/module-email-sender
=============================

N/A

1.0.3(9mo ago)1101ProprietaryPHP

Since Jul 23Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/SelectCo/magento2-module-email-sender)[ Packagist](https://packagist.org/packages/select-co/module-email-sender)[ RSS](/packages/select-co-module-email-sender/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

SelectCo Email Sender
=====================

[](#selectco-email-sender)

Lightweight Magento 2 helper module that provides a consistent way to compose and send transactional emails, including support for CC/BCC and file attachments.

It wraps Magento's TransportBuilder with a tiny API consisting of Email and Attachment value objects and a Sender service. This makes your application code simpler and keeps it transport-agnostic. If you also use SelectCo Mailgun, delivery will be handled by that module transparently.

Features
--------

[](#features)

- Simple Email interface for template, recipients, sender, vars, and options
- Optional CC and BCC recipients
- Attachment support via a custom TransportBuilder extension
- Works with Magento's native transport or third-party transports (e.g., SelectCo Mailgun)

Requirements
------------

[](#requirements)

- Magento 2 (tested with 2.3.5)
- PHP compatible with your Magento version
- Composer dependencies (handled via this module):
    - select-co/module-core 1.0.\*

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

[](#installation)

You can install this module either via Composer or by placing it in app/code.

### Composer (preferred)

[](#composer-preferred)

1. Require the package:
    - `composer require select-co/module-email-sender`
2. Enable and set up the module:
    - `bin/magento module:enable SelectCo_EmailSender`
    - `bin/magento setup:upgrade`
    - In production mode: `bin/magento setup:di:compile` and `bin/magento setup:static-content:deploy -f`

### Manual installation (app/code)

[](#manual-installation-appcode)

1. Copy this directory to `app/code/SelectCo/EmailSender`.
2. Run:
    - `bin/magento module:enable SelectCo_EmailSender`
    - `bin/magento setup:upgrade`
    - In production mode: `bin/magento setup:di:compile` and `bin/magento setup:static-content:deploy -f`

How it works
------------

[](#how-it-works)

- Value objects:
    - Email (SelectCo\\EmailSender\\Model\\Email\\Email): holds template identifier, vars, options, from, to, cc, bcc, and attachments
    - Attachment (SelectCo\\EmailSender\\Model\\Attachment\\Attachment): holds contents, filename, and MIME type
- TransportBuilder extension:
    - SelectCo\\EmailSender\\Model\\Mail\\Template\\TransportBuilder extends Magento's TransportBuilder to add attachments to the MIME message
- Sender service:
    - SelectCo\\EmailSender\\Model\\Sender composes the Magento transport from your Email and calls sendMessage()

If SelectCo Mailgun is enabled in your system, it will intercept Magento's transport and deliver via the Mailgun API; this module does not need to change.

Usage
-----

[](#usage)

Inject the Sender service where you need to send an email and construct an Email object.

Example (PHP):

```
public function __construct(\SelectCo\EmailSender\Model\Sender $sender)
{
    $this->sender = $sender;
}

$email = new \SelectCo\EmailSender\Model\Email\Email();
$email->setTemplateIdentifier('your_email_template_id');
$email->setTemplateVars([
    'var1' => 'value',
]);
$email->setTemplateOptions([
    'area'  => \Magento\Framework\App\Area::AREA_FRONTEND, // or AREA_ADMINHTML
    'store' => \Magento\Store\Model\Store::DEFAULT_STORE_ID,
]);
$email->setFromByScope(['name' => 'Store Name', 'email' => 'no-reply@example.com']);
$email->setTo(['john.doe@example.com']);
$email->setCc(['copy@example.com']);       // optional
$email->setBcc(['hidden@example.com']);    // optional

// Optional attachment
$attachment = new \SelectCo\EmailSender\Model\Attachment\Attachment();
$attachment->setFileName('invoice.pdf');
$attachment->setFileType('application/pdf');
$attachment->setContents($pdfBinaryContent); // pass raw binary/string content
$email->setAttachments([$attachment]);

// Send it
$this->sender->send($email);

```

Notes:

- getTo(), getCc(), and getBcc() accept either a string email or an array of emails.
- setFromByScope() accepts a sender array \['name' =&gt; ..., 'email' =&gt; ...\] or a configured identity code, consistent with Magento's TransportBuilder.
- When attachments are added, they are encoded and attached via Laminas MIME under the hood.

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

[](#configuration)

This module has no admin configuration. Ensure your email templates exist and the template identifier you use is available in the selected area.

Troubleshooting
---------------

[](#troubleshooting)

- Ensure the template identifier exists in the specified area (frontend or adminhtml)
- Verify From/To addresses are valid
- If using a transport module (e.g., SelectCo Mailgun), confirm that module is enabled and configured
- Check Magento logs for any MailException/LocalizedException stack traces

License
-------

[](#license)

MIT. See LICENSE.

Support
-------

[](#support)

If you have a feature request or spotted a bug or a technical problem, create a GitHub issue.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance61

Regular maintenance activity

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

299d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb8edf7bc18e5fb40dfff088ad0b26b0dbb4828d29ebee10131b9be858d4e5fb?d=identicon)[adrianb11](/maintainers/adrianb11)

---

Top Contributors

[![adrianb11](https://avatars.githubusercontent.com/u/77499644?v=4)](https://github.com/adrianb11 "adrianb11 (5 commits)")

### Embed Badge

![Health badge](/badges/select-co-module-email-sender/health.svg)

```
[![Health](https://phpackages.com/badges/select-co-module-email-sender/health.svg)](https://phpackages.com/packages/select-co-module-email-sender)
```

###  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

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

Connect MailChimp with Magento

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

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)

PHPackages © 2026

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