public function configure_phpmailer($phpmailer) { $settings = SparkPost::get_settings(); if (!$settings['enable_sparkpost'] || empty($settings['password'])) { return; } $tracking_enabled = (bool) $settings['enable_tracking']; $x_msys_api = array('options' => array('open_tracking' => (bool) apply_filters('wpsp_open_tracking', $tracking_enabled), 'click_tracking' => (bool) apply_filters('wpsp_click_tracking', $tracking_enabled), 'transactional' => (bool) apply_filters('wpsp_transactional', $settings['transactional']))); $phpmailer->isSMTP(); $phpmailer->SMTPSecure = 'tls'; $phpmailer->Port = !empty($settings['port']) ? intval($settings['port']) : 587; $phpmailer->Host = 'smtp.sparkpostmail.com'; $phpmailer->SMTPAuth = true; $phpmailer->Username = '******'; $phpmailer->Password = apply_filters('wpsp_api_key', $settings['password']); $json_x_msys_api = apply_filters('wpsp_smtp_msys_api', json_encode($x_msys_api)); $phpmailer->addCustomHeader('X-MSYS-API', $json_x_msys_api); }
public function __construct() { $this->settings = SparkPost::get_settings(false); add_action('admin_menu', array($this, 'add_plugin_page')); add_action('admin_init', array($this, 'admin_page_init')); }
/** * Constructor. * @param boolean $exceptions Should we throw external exceptions? */ function __construct($exceptions = false) { $this->settings = SparkPost::get_settings(); parent::__construct($exceptions); do_action('wpsp_init_mailer', $this); }