evo-mark/evo-postal-wp-transport

Base Postal integration for Wordpress

v1.2.0 2024-11-01 12:24 UTC

This package is auto-updated.

Last update: 2024-11-01 12:25:57 UTC


README

Build status Total Downloads License


Evo Postal WP Transport

A base-level integration for Postal on Wordpress applications. This package should be consumed by other plugins/themes

use EvoMark\EvoPostalWpTransport\Postal;

class MyPlugin
{
    public static function register()
    {
        $settings = self::getSettings();

        if ($settings['enabled']) {
            add_filter('pre_wp_mail', [__CLASS__, 'process'], 10, 2);
        }
    }

    public static function process($null, $atts)
    {
        $settings = self::getSettings();
        $transport = new Postal($settings, $atts);
        $result = $transport->send();
        return $result;
    }
}

Required settings

The $settings variable used above is an associative array with the following structure:

$settings = [
    'host' => '',
    'api_key' => '',
    'from_address' => '',
    'from_name' => ''
];