[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/config/check/ -> PhabricatorSetupCheckMail.php (source)

   1  <?php
   2  
   3  final class PhabricatorSetupCheckMail extends PhabricatorSetupCheck {
   4  
   5    protected function executeChecks() {
   6      $adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter');
   7  
   8      switch ($adapter) {
   9        case 'PhabricatorMailImplementationPHPMailerLiteAdapter':
  10          if (!Filesystem::pathExists('/usr/bin/sendmail') &&
  11              !Filesystem::pathExists('/usr/sbin/sendmail')) {
  12            $message = pht(
  13              'Mail is configured to send via sendmail, but this system has '.
  14              'no sendmail binary. Install sendmail or choose a different '.
  15              'mail adapter.');
  16  
  17            $this->newIssue('config.metamta.mail-adapter')
  18              ->setShortName(pht('Missing Sendmail'))
  19              ->setName(pht('No Sendmail Binary Found'))
  20              ->setMessage($message)
  21              ->addRelatedPhabricatorConfig('metamta.mail-adapter');
  22          }
  23          break;
  24        case 'PhabricatorMailImplementationAmazonSESAdapter':
  25          if (PhabricatorEnv::getEnvConfig('metamta.can-send-as-user')) {
  26            $message = pht(
  27              'Amazon SES does not support sending email as users. Disable '.
  28              'send as user, or choose a different mail adapter.');
  29  
  30            $this->newIssue('config.can-send-as-user')
  31              ->setName(pht("SES Can't Send As User"))
  32              ->setMessage($message)
  33              ->addRelatedPhabricatorConfig('metamta.mail-adapter')
  34              ->addPhabricatorConfig('metamta.can-send-as-user');
  35          }
  36  
  37          if (!PhabricatorEnv::getEnvConfig('amazon-ses.access-key')) {
  38            $message = pht(
  39              'Amazon SES is selected as the mail adapter, but no SES access '.
  40              'key is configured. Provide an SES access key, or choose a '.
  41              'different mail adapter.');
  42  
  43            $this->newIssue('config.amazon-ses.access-key')
  44              ->setName(pht('Amazon SES Access Key Not Set'))
  45              ->setMessage($message)
  46              ->addRelatedPhabricatorConfig('metamta.mail-adapter')
  47              ->addPhabricatorConfig('amazon-ses.access-key');
  48          }
  49  
  50          if (!PhabricatorEnv::getEnvConfig('amazon-ses.secret-key')) {
  51            $message = pht(
  52              'Amazon SES is selected as the mail adapter, but no SES secret '.
  53              'key is configured. Provide an SES secret key, or choose a '.
  54              'different mail adapter.');
  55  
  56            $this->newIssue('config.amazon-ses.secret-key')
  57              ->setName(pht('Amazon SES Secret Key Not Set'))
  58              ->setMessage($message)
  59              ->addRelatedPhabricatorConfig('metamta.mail-adapter')
  60              ->addPhabricatorConfig('amazon-ses.secret-key');
  61          }
  62  
  63          $address_key = 'metamta.default-address';
  64          $options = PhabricatorApplicationConfigOptions::loadAllOptions();
  65          $default = $options[$address_key]->getDefault();
  66          $value = PhabricatorEnv::getEnvConfig($address_key);
  67          if ($default === $value) {
  68            $message = pht(
  69              'Amazon SES requires verification of the "From" address, but '.
  70              'you have not configured a "From" address. Configure and verify '.
  71              'a "From" address, or choose a different mail adapter.');
  72  
  73            $this->newIssue('config.metamta.default-address')
  74              ->setName(pht('No SES From Address Configured'))
  75              ->setMessage($message)
  76              ->addRelatedPhabricatorConfig('metamta.mail-adapter')
  77              ->addPhabricatorConfig('metamta.default-address');
  78          }
  79          break;
  80      }
  81  
  82    }
  83  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1