PHPackages                             archey347/uf\_mailattachments - 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. archey347/uf\_mailattachments

ActiveUserfrosting-sprinkle[Mail &amp; Notifications](/categories/mail)

archey347/uf\_mailattachments
=============================

This sprinkle adds support for mail attachments in UF

v2.0.0(4y ago)247MITPHPPHP &gt;=5.6

Since Mar 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/archey347/UF_MailAttachments)[ Packagist](https://packagist.org/packages/archey347/uf_mailattachments)[ Docs](https://github.com/archey347/UF_EmailAttachments)[ RSS](/packages/archey347-uf-mailattachments/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

UF\_MailAttachments
===================

[](#uf_mailattachments)

This sprinkle adds support for mail attachments to UserFrosting

Deprecation Notice for v2
-------------------------

[](#deprecation-notice-for-v2)

Due to some weird PHP reasons, it can't seem to accept paremter types that are children of paremeter types of the parent class' method definition. I'm not sure what PHP version this became a problem in. I don't know if it's just something that I've done wrong, but for some reason the zend compiler barfs at it. As a cheap fix, for v2 of this sprinkle, you now have to call the `sendWithAttachments` or `sendDistinctWithAttachments` instead rather than the normal functions. I'll probably try and get it implemented in UF's mailer directly rather than having an extension.

Usage
-----

[](#usage)

Usage is similar, you just need to use differenct classes and a different service.

First, create a message

```
// Add this to the top
use UserFrosting\Sprinkle\MailAttachments\Mail\ExtendedTwigMailMessage;

$message = new ExtendedTwigMailMessage($this->ci->view, "mail/booking-confirmation.html.twig");

```

Usage of the `ExtendenTwigMailMessage` is the same as the standard [`TwigMailMessage`](https://learn.userfrosting.com/mail/the-mailer-service#senders-recipients-and-customized-content)

To add an atachment, create a `MailAttachment` Object

```
// Add this to the top
use UserFrosting\Sprinkle\MailAttachments\Mail\MailAttachment;

$attachment = New MailAttachment("Hello World","hello.txt");
// OR using UF's disk storage
$fs = $this->ci->filesystem;
$disk = $fs->disk("diskName");
$file = new MailAttachment($disk->get('hello.txt'), 'hello.txt');

// Then add to the message
$message->addAttachment($attachment);

```

To send the message use the `extendedMailer` service

```
$extendedMailer = $this->ci->extendedMailer;

$extendedMailer->sendDistinctWithAttachments($message);

```

Options
-------

[](#options)

The attachment object has four options which can be set in the constructor.

- `$file` - The contents of the file
- `$fileName` - The name of the file
- `$encoding` - How the file should be encoded (defaults to `PHPMailer::ENCODING_BASE64`)
- `$mimeType` - The mime type of the file (if left blank, PHPMailer will automatically detect the mime type)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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 ~709 days

Total

2

Last Release

1521d ago

Major Versions

v1.0.0 → v2.0.02022-03-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/21757281d6de281e8723109aeea6f74529b5fdbb7b93c1d988378a2690f64485?d=identicon)[archey347](/maintainers/archey347)

---

Top Contributors

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

---

Tags

userfrosting-sprinkleuserfrosting

### Embed Badge

![Health badge](/badges/archey347-uf-mailattachments/health.svg)

```
[![Health](https://phpackages.com/badges/archey347-uf-mailattachments/health.svg)](https://phpackages.com/packages/archey347-uf-mailattachments)
```

###  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.3M228](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M52](/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)
