PHPackages                             safemailer/safemailer - 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. safemailer/safemailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

safemailer/safemailer
=====================

A Laravel package for secure email attachments with expiration

0.4(1y ago)3331MITPHPPHP ^8.2

Since Dec 23Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/webmavens/safemailer)[ Packagist](https://packagist.org/packages/safemailer/safemailer)[ RSS](/packages/safemailer-safemailer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

Laravel SafeMailer
==================

[](#laravel-safemailer)

A Laravel package for secure email attachments with expiration functionality.

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

[](#installation)

1. Install the package via Composer:

```
composer require safemailer/safemailer
```

2. Add your SafeMailer() API key to your `.env` file:

```
SAFEMAILER_API_KEY=your_api_key_here
```

3. Change MAIL\_MAILER to be "safemailer" and MAIL\_FROM\_ADDRESS to be your mail in your .env file:

```
MAIL_MAILER=safemailer
MAIL_FROM_ADDRESS=YOUR_SAFE_MAILER_LOGIN_MAIL
```

Advanced Usage
--------------

[](#advanced-usage)

1. To define a expiration for the email:

```
$expiresAt = 'one_time'; // or 'never' ('never' is default)

Mail::mailer('safemailer')
    ->to($user)
    ->send(new ExampleMail($expiresAt));
```

Pass Headers from ExampleMail:

```
use Illuminate\Mail\Mailables\Headers;

public function headers(): Headers
{
   return new Headers(
      text: [
            'X-SafeMailer-Expiration-Type' => $this->expirationType,
      ],
   );
}
```

### Available Methods

[](#available-methods)

FUTURE FEATURE: You can use all standard Laravel Mail attachment methods - SafeMailer will automatically secure them:

```
// Basic attachment
->attach('/path/to/file.pdf')

// With custom filename
->attach('/path/to/file.pdf', [
    'as' => 'document.pdf'
])

// Attach multiple files
->attach('/path/to/file1.pdf')
->attach('/path/to/file2.pdf')
```

Security
--------

[](#security)

- All attachments are stored securely on SafeMailer's servers
- Files are automatically deleted after the expiration period
- Each attachment gets a unique, secure download link
- Downloads can be tracked and monitored

Best Practices
--------------

[](#best-practices)

1. Always set appropriate expiration times for sensitive documents
2. Use environment variables for API keys
3. Monitor attachment downloads through the SafeMailer dashboard
4. Keep your SafeMailer package updated to the latest version

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

[](#troubleshooting)

Common issues and solutions:

1. **API Key Issues**

    - Ensure your API key is correctly set in the `.env` file
    - Check if the API key is active in your SafeMailer dashboard
2. **File Upload Errors**

    - Verify file permissions
    - Check file size limits
    - Ensure proper file paths
3. **Configuration Issues**

    - Run `php artisan config:clear` after updating configuration
    - Verify published config file exists

Demo Video
----------

[](#demo-video)

Watch the demo video to learn how to use this package:

[![Package demo](https://camo.githubusercontent.com/ef767219c07afb5935c2398d708b086c71db0e0db724c7bc85f9ed03e10e3990/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f565f665f475537503961492f302e6a7067)](https://www.youtube.com/watch?v=V_f_GU7P9aI)

👉 [Click here to watch on YouTube](https://youtu.be/V_f_GU7P9aI)

Support
-------

[](#support)

For additional support:

- Submit issues on GitHub
- Contact

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance64

Regular maintenance activity

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.2% 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 ~36 days

Total

4

Last Release

402d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e073f589fa8589f8ad99461399e6ca6de1accfb94030fb0526707e17faa8ff5?d=identicon)[webmavens](/maintainers/webmavens)

---

Top Contributors

[![ssr-1125](https://avatars.githubusercontent.com/u/192307220?v=4)](https://github.com/ssr-1125 "ssr-1125 (12 commits)")[![webmavensteam](https://avatars.githubusercontent.com/u/66576112?v=4)](https://github.com/webmavensteam "webmavensteam (4 commits)")[![sawan-webmavens](https://avatars.githubusercontent.com/u/456840?v=4)](https://github.com/sawan-webmavens "sawan-webmavens (3 commits)")

### Embed Badge

![Health badge](/badges/safemailer-safemailer/health.svg)

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

###  Alternatives

[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/aws-sns

Amazon Simple Notification Service (AWS SNS) notification channel for Laravel.

541.1M2](/packages/laravel-notification-channels-aws-sns)[laravel-notification-channels/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[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)
