diff --git a/EmailHandler.php b/EmailHandler.php index 41592cb..36e071e 100644 --- a/EmailHandler.php +++ b/EmailHandler.php @@ -1,5 +1,4 @@ projectModel->getByEmail($payload['recipient']); + + if (empty($project)) { + $this->logger->info('Mailgun: ignored => project not found'); + return false; + } + // The user must exists in Kanboard $user = $this->userModel->getByEmail($payload['sender']); + // Check to see if a catchall user was specified - if the original sender is unrecognized if (empty($user)) { - $this->logger->info('Mailgun: ignored => user not found'); - return false; + $catchAllAddress = $this->projectMetadataModel->get($project['id'], 'mailgun_catch_all'); + $user = $this->userModel->getByEmail($catchAllAddress); + $this->logger->info('Mailgun: unknown user mapped to ' . $user['name'] . ' (' . $user['email'] . ') in project ' . $project['name']); } - // The project must have a short name - $project = $this->projectModel->getByEmail($payload['recipient']); - - if (empty($project)) { - $this->logger->info('Mailgun: ignored => project not found'); + if (empty($user)) { + $this->logger->info('Mailgun: ignored => user not found'); return false; } diff --git a/Locale/fr_FR/translations.php b/Locale/fr_FR/translations.php index 1e0a06d..7594d9a 100644 --- a/Locale/fr_FR/translations.php +++ b/Locale/fr_FR/translations.php @@ -2,5 +2,7 @@ return array( 'Help on Mailgun integration' => 'Aide sur l\'intégration avec Mailgun', + 'Catch-All Email Address' => 'Adresse e-mail « attrape-tout » (catch-all)', + 'Blank value will cause unknown senders to be ignored' => 'Une valeur vide ignore les expéditeurs inconnus' ); diff --git a/Plugin.php b/Plugin.php index 28f4dac..5a72b78 100644 --- a/Plugin.php +++ b/Plugin.php @@ -17,9 +17,10 @@ class Plugin extends Base public function initialize() { $this->emailClient->setTransport('mailgun', '\Kanboard\Plugin\Mailgun\EmailHandler'); + $this->template->hook->attach('template:project:integrations', 'mailgun:project/integration'); $this->template->hook->attach('template:config:integrations', 'mailgun:config/integration'); - $this->route->addRoute('/mailgun/handler/:token', 'WebhookController', 'receiver', 'mailgun'); $this->applicationAccessMap->add('WebhookController', 'receiver', Role::APP_PUBLIC); + $this->route->addRoute('/mailgun/handler/:token', 'WebhookController', 'receiver', 'mailgun'); } public function onStartup() @@ -39,7 +40,7 @@ public function getPluginAuthor() public function getPluginVersion() { - return '1.0.10'; + return '1.0.11'; } public function getPluginHomepage() diff --git a/README.md b/README.md index abcf4bf..7088aba 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,14 @@ Notes Changes ------- +### Version 1.0.11 + +- For unknown senders you can now accept them into a project by specifying a user to accept the task - this is configurable on a project level - leaving the setting blank will cause unknown senders to be ignored. + +### Version 1.0.10 + +- Update help link URL + ### Version 1.0.9 - Tasks created by incoming email are assigned to the recipient diff --git a/Template/project/integration.php b/Template/project/integration.php new file mode 100644 index 0000000..635ea88 --- /dev/null +++ b/Template/project/integration.php @@ -0,0 +1,14 @@ +
+ = t('Blank value will cause unknown senders to be ignored') ?> - + = t('Help on Mailgun integration') ?> +
+ +