evo-mark/evo-postal-wp-transport

Base Postal integration for Wordpress

v1.1.2 2024-10-02 00:26 UTC

This package is auto-updated.

Last update: 2024-10-02 00:27:50 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' => ''
];