Differential D9375 Diff 24738 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 51 Lines • ▼ Show 20 Lines | public function addHeader($header_name, $header_value) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setBody($body) { | public function setBody($body) { | ||||
| $this->params['body'] = $body; | $this->params['body'] = $body; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setSubject($subject) { | public function setHTMLBody($html_body) { | ||||
| $this->params['subject'] = $subject; | $this->params['html-body'] = $html_body; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setIsHTML($is_html) { | public function setSubject($subject) { | ||||
| $this->params['is-html'] = $is_html; | $this->params['subject'] = $subject; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function supportsMessageIDHeader() { | public function supportsMessageIDHeader() { | ||||
| return true; | return true; | ||||
| } | } | ||||
| public function send() { | public function send() { | ||||
| $key = PhabricatorEnv::getEnvConfig('mailgun.api-key'); | $key = PhabricatorEnv::getEnvConfig('mailgun.api-key'); | ||||
| $domain = PhabricatorEnv::getEnvConfig('mailgun.domain'); | $domain = PhabricatorEnv::getEnvConfig('mailgun.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'); | ||||
| if (idx($this->params, 'is-html')) { | |||||
| $params['html'] = idx($this->params, 'body'); | |||||
| } else { | |||||
| $params['text'] = idx($this->params, 'body'); | $params['text'] = idx($this->params, 'body'); | ||||
| if (idx($this->params, 'html-body')) { | |||||
| $params['html'] = idx($this->params, 'html-body'); | |||||
| } | } | ||||
| $from = idx($this->params, 'from'); | $from = idx($this->params, 'from'); | ||||
| if (idx($this->params, 'from-name')) { | if (idx($this->params, 'from-name')) { | ||||
| $params['from'] = "{$this->params['from-name']} <{$from}>"; | $params['from'] = "{$this->params['from-name']} <{$from}>"; | ||||
| } else { | } else { | ||||
| $params['from'] = $from; | $params['from'] = $from; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||