diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-04-19 16:01:41 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-04-19 16:01:41 -0400 |
commit | ac86c3100a1030026024c33c1cf02ec79f08ff51 (patch) | |
tree | 9b19c00122c6e405a01e7144072246cff456fe30 /app/Controller | |
parent | 392133d9ba27cacab18eac2ab8b10beb846a4cca (diff) |
Add Mailgun integration (incoming emails)
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Webhook.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/app/Controller/Webhook.php b/app/Controller/Webhook.php index afa0543a..06bfcd4e 100644 --- a/app/Controller/Webhook.php +++ b/app/Controller/Webhook.php @@ -112,8 +112,20 @@ class Webhook extends Base $this->response->text('Not Authorized', 401); } - $result = $this->postmarkWebhook->parsePayload($this->request->getJson() ?: array()); + echo $this->postmarkWebhook->parsePayload($this->request->getJson() ?: array()) ? 'PARSED' : 'IGNORED'; + } - echo $result ? 'PARSED' : 'IGNORED'; + /** + * Handle Mailgun webhooks + * + * @access public + */ + public function mailgun() + { + if ($this->config->get('webhook_token') !== $this->request->getStringParam('token')) { + $this->response->text('Not Authorized', 401); + } + + echo $this->mailgunWebhook->parsePayload($_POST) ? 'PARSED' : 'IGNORED'; } } |