Differential D19002 Diff 45600 src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | public function setSubject($subject) { | ||||
$this->params['subject'] = $subject; | $this->params['subject'] = $subject; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function supportsMessageIDHeader() { | public function supportsMessageIDHeader() { | ||||
return true; | return true; | ||||
} | } | ||||
protected function validateOptions(array $options) { | |||||
PhutilTypeSpec::checkMap( | |||||
$options, | |||||
array( | |||||
'api-key' => 'string', | |||||
'domain' => 'string', | |||||
)); | |||||
} | |||||
public function newDefaultOptions() { | |||||
return array( | |||||
'api-key' => null, | |||||
'domain' => null, | |||||
); | |||||
} | |||||
public function newLegacyOptions() { | |||||
return array( | |||||
'api-key' => PhabricatorEnv::getEnvConfig('mailgun.api-key'), | |||||
'domain' => PhabricatorEnv::getEnvConfig('mailgun.domain'), | |||||
); | |||||
} | |||||
public function send() { | public function send() { | ||||
$key = PhabricatorEnv::getEnvConfig('mailgun.api-key'); | $key = $this->getOption('api-key'); | ||||
$domain = PhabricatorEnv::getEnvConfig('mailgun.domain'); | $domain = $this->getOption('domain'); | ||||
$params = array(); | $params = array(); | ||||
$params['to'] = implode(', ', idx($this->params, 'tos', array())); | $params['to'] = implode(', ', idx($this->params, 'tos', array())); | ||||
$params['subject'] = idx($this->params, 'subject'); | $params['subject'] = idx($this->params, 'subject'); | ||||
$params['text'] = idx($this->params, 'body'); | $params['text'] = idx($this->params, 'body'); | ||||
if (idx($this->params, 'html-body')) { | if (idx($this->params, 'html-body')) { | ||||
$params['html'] = idx($this->params, 'html-body'); | $params['html'] = idx($this->params, 'html-body'); | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |