PHPackages                             ptejada/laravel-mailgun-options - 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. ptejada/laravel-mailgun-options

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

ptejada/laravel-mailgun-options
===============================

Laravel mailgun driver helper to toggle email opens, clicks, tag emails and more per mailable.

2.0.0(3y ago)436[1 issues](https://github.com/ptejada/laravel-mailgun-options/issues)MITPHPCI failing

Since Dec 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ptejada/laravel-mailgun-options)[ Packagist](https://packagist.org/packages/ptejada/laravel-mailgun-options)[ RSS](/packages/ptejada-laravel-mailgun-options/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (7)Used By (0)

Laravel Mailgun Options [![](https://github.com/ptejada/laravel-mailgun-options/workflows/Unit%20Test/badge.svg?branch=master)](https://github.com/ptejada/laravel-mailgun-options/workflows/Unit%20Test/badge.svg?branch=master) [![Packagist](https://camo.githubusercontent.com/ae58399fcd0be7314564386774c71a308f4b6882a8bd4fe0a6f9012014508dfd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7074656a6164612f6c61726176656c2d6d61696c67756e2d6f7074696f6e732e737667)](https://packagist.org/packages/ptejada/laravel-mailgun-options)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#laravel-mailgun-options--)

The package enhances the builtin Laravel Mailgun driver with helpers to manage the Mailgun specific features in a per email message basis. The following options can be configures with the helper:

1. Toggle tracking email opens.
2. Toggle tracking email link clicks.
3. Add email tags.
4. Attach variables and recipient variables to email.
5. Enable test mode.
6. Schedule email to be delivery in the future.

Refer to the [Send via SMTP](https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-smtp) section of the Mailgun API docs for more information.

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

[](#installation)

Install package via composer

```
composer require ptejada/laravel-mailgun-options

```

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

[](#compatibility)

The package is tested and should be compatible with the following PHP and Laravel versions

PHPLaravel7.37.x7.47.x, 8.x8.07.x, 8.x, 9.x8.18.x, 9.xUsage
-----

[](#usage)

Add the `PabloTejada\MailgunOptions\MailgunOptions` trait to any mailable class you want to configure. Within the `build` method of the mailable you can configure the Mailgun options using the following helpers:

- **track()** - Track both email opens and clicks.
- **trackClicks()** - Track when links in the email ar clicked.
- **trackOpens()** - Track when the email is opened.
- **deliverBy()** - Schedules the email to be deliver at a later time.
- **testMode()** - Sends the email in test mode.
- **tags()** - Adds one or more tags to the email.
- **variables** - Attach variables to the email.
- **recipientVariables** - Attach recipient specific variables to the email.
- **dkimSignature** - Toggles the DKIM signatures.

Example mailable class

```
