evo-mark / evo-postal-wp-transport
Wordpress 的基础邮政集成
v1.1.1
2024-09-30 10:41 UTC
Requires
- postal/postal: ^2.0.0
README
Evo Postal WP Transport
Wordpress 应用程序上 Postal 的基础级集成。此软件包应由其他插件/主题使用
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 变量是一个具有以下结构的关联数组
$settings = [ 'host' => '', 'api_key' => '', 'from_address' => '', 'from_name' => '' ];