Projects
Infrastructure
phabricator
0004-Unbundle-Amazon-SES.patch
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-Unbundle-Amazon-SES.patch of Package phabricator
From fa229d8f4e82f7b730859585beefee10cce98313 Mon Sep 17 00:00:00 2001 From: "Jeroen van Meeuwen (Kolab Systems)" <vanmeeuwen@kolabsys.com> Date: Wed, 10 Aug 2016 11:08:11 +0200 Subject: [PATCH 04/15] Unbundle Amazon SES --- externals/phpmailer/class.phpmailer-lite.php | 6 -- src/__phutil_library_map__.php | 2 - .../config/check/PhabricatorMailSetupCheck.php | 69 ---------------------- .../config/option/PhabricatorAWSConfigOptions.php | 18 ------ ...abricatorMailImplementationAmazonSESAdapter.php | 37 ------------ 5 files changed, 132 deletions(-) delete mode 100644 src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php diff --git a/externals/phpmailer/class.phpmailer-lite.php b/externals/phpmailer/class.phpmailer-lite.php index c064d6c..4491169 100644 --- a/externals/phpmailer/class.phpmailer-lite.php +++ b/externals/phpmailer/class.phpmailer-lite.php @@ -489,12 +489,6 @@ class PHPMailerLite { // Choose the mailer and send through it switch($this->Mailer) { - - case 'amazon-ses': - return $this->customMailer->executeSend( - $header. - $body); - case 'sendmail': $sendAction = $this->SendmailSend($header, $body); return $sendAction; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index dfde2bc..0d65c8f 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2861,7 +2861,6 @@ phutil_register_library_map(array( 'PhabricatorMailEmailHeraldFieldGroup' => 'applications/metamta/herald/PhabricatorMailEmailHeraldFieldGroup.php', 'PhabricatorMailEmailSubjectHeraldField' => 'applications/metamta/herald/PhabricatorMailEmailSubjectHeraldField.php', 'PhabricatorMailImplementationAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAdapter.php', - 'PhabricatorMailImplementationAmazonSESAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php', 'PhabricatorMailImplementationMailgunAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php', 'PhabricatorMailImplementationPHPMailerAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationPHPMailerAdapter.php', 'PhabricatorMailImplementationPHPMailerLiteAdapter' => 'applications/metamta/adapter/PhabricatorMailImplementationPHPMailerLiteAdapter.php', @@ -7841,7 +7840,6 @@ phutil_register_library_map(array( 'PhabricatorMailEmailHeraldFieldGroup' => 'HeraldFieldGroup', 'PhabricatorMailEmailSubjectHeraldField' => 'PhabricatorMailEmailHeraldField', 'PhabricatorMailImplementationAdapter' => 'Phobject', - 'PhabricatorMailImplementationAmazonSESAdapter' => 'PhabricatorMailImplementationPHPMailerLiteAdapter', 'PhabricatorMailImplementationMailgunAdapter' => 'PhabricatorMailImplementationAdapter', 'PhabricatorMailImplementationPHPMailerAdapter' => 'PhabricatorMailImplementationAdapter', 'PhabricatorMailImplementationPHPMailerLiteAdapter' => 'PhabricatorMailImplementationAdapter', diff --git a/src/applications/config/check/PhabricatorMailSetupCheck.php b/src/applications/config/check/PhabricatorMailSetupCheck.php index 2b8e4e1..3202f8f 100644 --- a/src/applications/config/check/PhabricatorMailSetupCheck.php +++ b/src/applications/config/check/PhabricatorMailSetupCheck.php @@ -25,75 +25,6 @@ final class PhabricatorMailSetupCheck extends PhabricatorSetupCheck { ->addRelatedPhabricatorConfig('metamta.mail-adapter'); } break; - case 'PhabricatorMailImplementationAmazonSESAdapter': - if (PhabricatorEnv::getEnvConfig('metamta.can-send-as-user')) { - $message = pht( - 'Amazon SES does not support sending email as users. Disable '. - 'send as user, or choose a different mail adapter.'); - - $this->newIssue('config.can-send-as-user') - ->setName(pht("SES Can't Send As User")) - ->setMessage($message) - ->addRelatedPhabricatorConfig('metamta.mail-adapter') - ->addPhabricatorConfig('metamta.can-send-as-user'); - } - - if (!PhabricatorEnv::getEnvConfig('amazon-ses.access-key')) { - $message = pht( - 'Amazon SES is selected as the mail adapter, but no SES access '. - 'key is configured. Provide an SES access key, or choose a '. - 'different mail adapter.'); - - $this->newIssue('config.amazon-ses.access-key') - ->setName(pht('Amazon SES Access Key Not Set')) - ->setMessage($message) - ->addRelatedPhabricatorConfig('metamta.mail-adapter') - ->addPhabricatorConfig('amazon-ses.access-key'); - } - - if (!PhabricatorEnv::getEnvConfig('amazon-ses.secret-key')) { - $message = pht( - 'Amazon SES is selected as the mail adapter, but no SES secret '. - 'key is configured. Provide an SES secret key, or choose a '. - 'different mail adapter.'); - - $this->newIssue('config.amazon-ses.secret-key') - ->setName(pht('Amazon SES Secret Key Not Set')) - ->setMessage($message) - ->addRelatedPhabricatorConfig('metamta.mail-adapter') - ->addPhabricatorConfig('amazon-ses.secret-key'); - } - - if (!PhabricatorEnv::getEnvConfig('amazon-ses.endpoint')) { - $message = pht( - 'Amazon SES is selected as the mail adapter, but no SES endpoint '. - 'is configured. Provide an SES endpoint or choose a different '. - 'mail adapter.'); - - $this->newIssue('config.amazon-ses.endpoint') - ->setName(pht('Amazon SES Endpoint Not Set')) - ->setMessage($message) - ->addRelatedPhabricatorConfig('metamta.mail-adapter') - ->addPhabricatorConfig('amazon-ses.endpoint'); - } - - $address_key = 'metamta.default-address'; - $options = PhabricatorApplicationConfigOptions::loadAllOptions(); - $default = $options[$address_key]->getDefault(); - $value = PhabricatorEnv::getEnvConfig($address_key); - if ($default === $value) { - $message = pht( - 'Amazon SES requires verification of the "From" address, but '. - 'you have not configured a "From" address. Configure and verify '. - 'a "From" address, or choose a different mail adapter.'); - - $this->newIssue('config.metamta.default-address') - ->setName(pht('No SES From Address Configured')) - ->setMessage($message) - ->addRelatedPhabricatorConfig('metamta.mail-adapter') - ->addPhabricatorConfig('metamta.default-address'); - } - break; } } diff --git a/src/applications/config/option/PhabricatorAWSConfigOptions.php b/src/applications/config/option/PhabricatorAWSConfigOptions.php index 6647930..5f2246f 100644 --- a/src/applications/config/option/PhabricatorAWSConfigOptions.php +++ b/src/applications/config/option/PhabricatorAWSConfigOptions.php @@ -21,24 +21,6 @@ final class PhabricatorAWSConfigOptions public function getOptions() { return array( - $this->newOption('amazon-ses.access-key', 'string', null) - ->setLocked(true) - ->setDescription(pht('Access key for Amazon SES.')), - $this->newOption('amazon-ses.secret-key', 'string', null) - ->setHidden(true) - ->setDescription(pht('Secret key for Amazon SES.')), - $this->newOption('amazon-ses.endpoint', 'string', null) - ->setLocked(true) - ->setDescription( - pht( - 'SES endpoint domain name. You can find a list of available '. - 'regions and endpoints in the AWS documentation.')) - ->addExample( - 'email.us-east-1.amazonaws.com', - pht('US East (N. Virginia, Older default endpoint)')) - ->addExample( - 'email.us-west-2.amazonaws.com', - pht('US West (Oregon)')), $this->newOption('amazon-s3.access-key', 'string', null) ->setLocked(true) ->setDescription(pht('Access key for Amazon S3.')), diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php deleted file mode 100644 index 5b03cd8..0000000 --- a/src/applications/metamta/adapter/PhabricatorMailImplementationAmazonSESAdapter.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -final class PhabricatorMailImplementationAmazonSESAdapter - extends PhabricatorMailImplementationPHPMailerLiteAdapter { - - private $message; - private $isHTML; - - public function __construct() { - parent::__construct(); - $this->mailer->Mailer = 'amazon-ses'; - $this->mailer->customMailer = $this; - } - - public function supportsMessageIDHeader() { - // Amazon SES will ignore any Message-ID we provide. - return false; - } - - /** - * @phutil-external-symbol class SimpleEmailService - */ - public function executeSend($body) { - $key = PhabricatorEnv::getEnvConfig('amazon-ses.access-key'); - $secret = PhabricatorEnv::getEnvConfig('amazon-ses.secret-key'); - $endpoint = PhabricatorEnv::getEnvConfig('amazon-ses.endpoint'); - - $root = phutil_get_library_root('phabricator'); - $root = dirname($root); - require_once $root.'/externals/amazon-ses/ses.php'; - - $service = new SimpleEmailService($key, $secret, $endpoint); - $service->enableUseExceptions(true); - return $service->sendRawEmail($body); - } - -} -- 2.9.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.