-
-
Save skynet/e43276cb9456a88fc98b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $ses = Aws\Ses\SesClient::factory(array( | |
| 'key' => SES_KEY, | |
| 'secret' => SES_SECRET, | |
| 'region' => SES_REGION | |
| )); | |
| class SesClientProxyForPHPMailer { | |
| private $phpmailer; | |
| public function __construct($phpmailer) { | |
| $this->phpmailer = $phpmailer; | |
| } | |
| public function Send() { | |
| global $ses; | |
| $this->phpmailer->preSend(); | |
| try { | |
| return $ses->sendRawEmail([ | |
| 'RawMessage' => [ 'Data' => base64_encode($this->phpmailer->getSentMIMEMessage()) ] | |
| ]); | |
| } catch (Exception $e) { | |
| trigger_error($e->getMessage()); | |
| throw new phpmailerException($e->getMessage(), $e->getCode()); | |
| } | |
| } | |
| } | |
| add_action('phpmailer_init', function(&$phpmailer) { | |
| $phpmailer = new SesClientProxyForPHPMailer($phpmailer); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment