PHP code example of evo-mark / evo-postal-wp-transport

1. Go to this page and download the library: Download evo-mark/evo-postal-wp-transport library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

evo-mark / evo-postal-wp-transport example snippets


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;
    }
}

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