PHPackages                             kreativabyran/kb-mailer - 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. kreativabyran/kb-mailer

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

kreativabyran/kb-mailer
=======================

Provides a simple way of building and sending templated emails in WordPress

v2.1.2(2y ago)011PHP

Since Apr 5Pushed 2y agoCompare

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

READMEChangelog (9)DependenciesVersions (20)Used By (0)

KB Mailer
=========

[](#kb-mailer)

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

[](#installation)

Composer
--------

[](#composer)

```
composer require kreativabyran/kb-mailer

```

Plugin
------

[](#plugin)

Download zip-file from the latest release and install as plugin.

Usage
-----

[](#usage)

### Register email

[](#register-email)

First you have to register an email that you later can send. This is done with `kbm_register_email()`, which should be hooked on `init`.

paramtypedesc$id`string`Email ID. Used for sending.$name`string`Email name displayed in WP-admin. Also used for email subject.$content\_variables`array`*(Optional)* Each array element needs a key, which is later used for replacing the variable.
The array element value is a description which will be shown in the wp-admin page for building the email.Example:

```
add_action(
   'init',
   function() {
       if ( function_exists( 'kbm_register_email' ) ) {
           kbm_register_email(
               'contact',
               'Contact request',
               array(
                   'name'    => 'Name of person requesting contact',
                   'message' => 'Message from person',
               )
           );
       }
   }
);
```

*Note that the `function_exists()` check is only needed when using as plugin, not when installing from composer.*

### Editing email

[](#editing-email)

Go to wp-admin &gt; KB Mailer to see a list with all registered emails, there you can edit each part of the email, and use the registered content variables in the template.

### Send email

[](#send-email)

Registered emails are sent with `kbm_send_email()`

paramtypedesc$id`string`Email ID as registered in `kbm_register_email()`.$to`string`Email receiver address.$content\_variables`array`*(Optional)* Element key matches the one registered in `kbm_register_email()`.
Value is what should be used the email.$subject`string`*(Optional)* Email subject. Name as registered in `kbm_register_email()` will be used if this is not supplied.$attachments`array`*(Optional)* Array of attachments. Paths to files to attach.Example:```
$to      = 'contact@example.com';
$name    = 'Oskar Modig';
$message = 'Hi! I would really like to get in touch with you.';
if ( function_exists( 'kbm_send_email' ) ) {
    kbm_send_email(
        'contact',
        $to,
        array(
            'name'    => $name,
            'message' => $message,
        )
    );
} else {
    // Failsafe if plugin is unavailable.
    wp_mail( $to, 'Contact request', "Contact request from $name$message", array( 'Content-Type: text/html; charset=UTF-8' ) );
}
```

*The failsafe isn't necessary when kb-mailer has been installed from composer.*

Configuration
-------------

[](#configuration)

### Permissions

[](#permissions)

KB Mailer defaults to showing the email builder interface in wp-admin to user with the `manage_options` capability. The required capability can be changed with the `kb_mailer_admin_page_capability`-filter.

### Variable separators

[](#variable-separators)

The default variable separator is `%`. Meaning that `%name%` entered in the email content will be replaced with the value for that variable. The percentage sign before and/or after the variable id can be replaced with the following filters:

- `kb_mailer_content_variable_before`
- `kb_mailer_content_variable_after`

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

Recently: every ~140 days

Total

14

Last Release

784d ago

Major Versions

1.8.0 → v2.0.02022-04-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/2abb01c1b9b59a5f873d1db1e7421ef9af07d826fb04f069b80ed5aa181204ff?d=identicon)[kreativa](/maintainers/kreativa)

![](https://www.gravatar.com/avatar/0f541ecb55908839178d42c40cd4cf138ca5e9e9f3981d0d1ccd5845712f0ad7?d=identicon)[oskarmodig](/maintainers/oskarmodig)

---

Top Contributors

[![oskarmodig](https://avatars.githubusercontent.com/u/3178877?v=4)](https://github.com/oskarmodig "oskarmodig (72 commits)")

### Embed Badge

![Health badge](/badges/kreativabyran-kb-mailer/health.svg)

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

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

Web Push library for PHP

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