public function get_client()
{
require_once dirname(dirname(__FILE__)) . '/lib/aws-sdk/aws-autoloader.php';
$params = array('version' => '2010-12-01');
if ($this->key && $this->secret) {
$params['key'] = $this->key;
$params['secret'] = $this->secret;
}
if ($this->region) {
$params['signature'] = 'v4';
$params['region'] = $this->region;
}
if (defined('WP_PROXY_HOST') && defined('WP_PROXY_PORT')) {
$proxy_auth = '';
$proxy_address = WP_PROXY_HOST . ':' . WP_PROXY_PORT;
if (defined('WP_PROXY_USERNAME') && defined('WP_PROXY_PASSWORD')) {
$proxy_auth = WP_PROXY_USERNAME . ':' . WP_PROXY_PASSWORD . '@';
}
$params['request.options']['proxy'] = $proxy_auth . $proxy_address;
}
$params = apply_filters('aws_ses_wp_mail_ses_client_params', $params);
try {
return \Aws\Common\Aws::factory($params)->get('ses');
} catch (\Exception $e) {
return new WP_Error(get_class($e), $e->getMessage());
}
}