PHPackages                             beebmx/kirby-courier - 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. beebmx/kirby-courier

ActiveKirby-plugin[Mail &amp; Notifications](/categories/mail)

beebmx/kirby-courier
====================

Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.

1.5.0(6mo ago)403.0k—6.7%1MITPHPPHP ^8.3CI passing

Since Aug 7Pushed 6mo ago2 watchersCompare

[ Source](https://github.com/beebmx/kirby-courier)[ Packagist](https://packagist.org/packages/beebmx/kirby-courier)[ Docs](https://github.com/beebmx/kirby-courier)[ GitHub Sponsors](https://github.com/beebmx)[ RSS](/packages/beebmx-kirby-courier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (17)Used By (1)

[![Kirby Courier Logo](https://github.com/beebmx/kirby-courier/raw/main/assets/logo.svg?raw=true)](https://github.com/beebmx/kirby-courier)

[![Build Status](https://camo.githubusercontent.com/8b237312701cf9526d01eac1143678b56be7c33c6dc3c207ce1542134d20bc0b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f626565626d782f6b697262792d636f75726965722f74657374732e796d6c3f6272616e63683d6d61696e)](https://github.com/beebmx/kirby-courier/actions)[![Total Downloads](https://camo.githubusercontent.com/ae8d19223f72b5f3cecbfd45ee17113371c9f2b092551be0ec20994617aacf7e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626565626d782f6b697262792d636f7572696572)](https://packagist.org/packages/beebmx/kirby-courier)[![Latest Stable Version](https://camo.githubusercontent.com/16029920d3a38c08e56138ac1284a1c57717b14be5ff693b7f76da69f8bf22b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626565626d782f6b697262792d636f7572696572)](https://packagist.org/packages/beebmx/kirby-courier)[![License](https://camo.githubusercontent.com/44c85cb32c3a89daf4278b76bb5110bd1c1bbce941f5f8c5c703237252ad3a91/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626565626d782f6b697262792d636f7572696572)](https://packagist.org/packages/beebmx/kirby-courier)

Courier for Kirby
=================

[](#courier-for-kirby)

`Courier` offers a convenient and painless solution for creating emails tailored for your `Kirby` website. With `Courier`, you can streamline the process of email design and implementation for your site.

---

Overview
--------

[](#overview)

- [1. Installation](#installation)
- [2. Usage](#usage)
- [3. Snippets](#snippets)
- [4. Console](#console)
- [5. Helper](#helper)
- [6. Challenge](#challenge)
- [7. Testing email](#testing-email)
- [8. Options](#options)
- [9. License](#license)
- [10. Credits](#credits)

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

[](#installation)

### Download

[](#download)

Download and copy this repository to `/site/plugins/kirby-courier`.

### Composer

[](#composer)

```
composer require beebmx/kirby-courier

```

Usage
-----

[](#usage)

`Courier` comes with two email `message` types, and you can customize them for your convenience.

[![Kirby Courier example](https://raw.githubusercontent.com/beebmx/kirby-courier/main/assets/example.png)](https://raw.githubusercontent.com/beebmx/kirby-courier/main/assets/example.png)

### Notification message

[](#notification-message)

The `Notification` message is the easiest way to send an email. You only need to use the `Beebmx\KirbyCourier\Notification\Message` class in your `controller` or in your own implementation. Here's an example:

```
use Beebmx\KirbyCourier\Notification\Message;

(new Message)
    ->to('john@doe.co')
    ->line('Welcome to Kirby Courier')
    ->action('Visit', 'https://beeb.mx')
    ->send()
```

#### Formating notification messages

[](#formating-notification-messages)

You have several methods to customize your `Notification` message. Here's an example with all the methods:

```
use Beebmx\KirbyCourier\Notification\Message;

(new Message)
    ->to('john@doe.co')
    ->greeting('Hello friend!')
    ->line('Welcome to Kirby Courier')
    ->line('You can add more lines before an action')
    ->lines(['Multiple line 01', 'Multiple line 02'])
    ->lineIf($someCondition === true, 'You can add more lines before an action')
    ->linesIf($someCondition === false, ['Line 03', 'Line 04'])
    ->success()         // To set the action button as successful
    ->error()           // To set the action button as an error
    ->action('Action button', 'https://beeb.mx')
    ->line('You can add lines after an action')
    ->salutation('Good bye!')
    ->send()
```

Warning

You can only add one `action` per `Notification` message.

### Mail message

[](#mail-message)

The `Mail` message is the easiest way to send an email if you need to customize all the body of your email, you only need to use the `Beebmx\KirbyCourier\Mail\Message` class in your `controller` or in your own implementation. Here's an example:

```
use Beebmx\KirbyCourier\Mail\Message;

(new Message)
    ->to('john@doe.co')
    ->template('marketing')
    ->send()
```

Note

It's important that you set a `template` to display your own customization. Every template should be located in your `courier` directory.

#### Formating mail messages

[](#formating-mail-messages)

To create your own `template` for your `mail` messages, you need to create a file in the default location for `Courier`. Here's an example for a marketing message:

```
/*** /site/template/courier/marketing.php ***/
