PHPackages                             programmatordev/kinky - 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. programmatordev/kinky

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

programmatordev/kinky
=====================

Inky email templating language for Kirby CMS

0.3.1(1mo ago)12MITCSSPHP &gt;=8.2.0

Since Apr 14Pushed 1mo agoCompare

[ Source](https://github.com/programmatordev/kinky)[ Packagist](https://packagist.org/packages/programmatordev/kinky)[ Docs](https://github.com/programmatordev/kinky)[ RSS](/packages/programmatordev-kinky/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (7)Used By (0)

Kinky
=====

[](#kinky)

[Kirby](https://getkirby.com/) + [Inky](https://get.foundation/emails/docs/inky.html) = Kinky.

Converts simple HTML tags into the complex table required for emails. Oh là là!

Table of Contents
-----------------

[](#table-of-contents)

- [TL;DR](#tldr)
- [How it Works](#how-it-works)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
    - [transformTemplate](#transformtemplate)
    - [email](#email)
- [Cookbook](#cookbook)

TL;DR
-----

[](#tldr)

Building HTML emails is painful.

You're stuck using archaic table-based layouts, and you constantly have to fight against inconsistent rendering across outdated email clients (like Outlook). Modern web standards? Mostly ignored.

To make life easier, this plugin was created so you can write cleaner code and still get reliable results across all major email clients.

How it Works
------------

[](#how-it-works)

This plugin streamlines HTML email development by integrating a transpiler and inliner workflow built around [Inky](https://get.foundation/emails/docs/inky.html).

It uses a [transpiler](https://github.com/lorenzo/pinky) that converts [Inky](https://get.foundation/emails/docs/inky.html)'s custom components into table-based HTML, ensuring compatibility with legacy email clients.

After that, it passes the output through a [CSS inliner](https://github.com/tijsverkoyen/CssToInlineStyles)that merges both [Inky](https://get.foundation/emails/docs/inky.html)'s default styles and any custom CSS into inline styles.

The result is clean, reliable HTML emails that render consistently across major clients like Outlook, Gmail, and Apple Mail — without giving up modern development convenience.

### Example

[](#example)

Simple usage of Inky base components (it is recommended to include the `body` class to enable responsive columns):

```

            Kinky
            Oh là là

```

Transformed HTML (clean example without the whole document and CSS inlining):

```

                                            Kinky

                                            Oh là là

```

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

[](#requirements)

- PHP `8.2` or higher;
- PHP [`dom`](http://www.php.net/manual/en/dom.installation.php) extension;
- Kirby CMS `5.0` or higher.

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

[](#installation)

Install the plugin via [Composer](https://getcomposer.org/):

```
composer require programmatordev/kinky
```

Usage
-----

[](#usage)

A global `kinky()` function is available to create and send emails.

### `transformTemplate`

[](#transformtemplate)

```
kinky()->transformTemplate(string $template, array $data = []): string
```

Returns the final transformed HTML from the given `$template`. Take into account that email templates must be located in the `/site/templates/emails/` directory.

Note

Check the documentation regarding how emails work in [Kirby](https://getkirby.com/docs/guide/emails).

You can pass data into the template using the `$data` parameter.

This method can be useful to help creating and previewing email templates:

```
// templates/default.php

// the template will be located at /site/templates/emails/notification.html.php
