Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias <git@myrho.net>2021-03-26 22:16:13 +0300
committerMatthias <git@myrho.net>2021-03-26 22:37:10 +0300
commit69b905d92cc6b37b0e5ad506f8ff198d6b87dc0e (patch)
treeaaccb2b69cb2e8e94f7f92817cf24e3119a50214 /lib/Controller
parent5bf2f9667fbefbad5e695b862c5e59bf823190db (diff)
warn before sending to many recipients in to/cc
Signed-off-by: Matthias <git@myrho.net>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/AccountsController.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Controller/AccountsController.php b/lib/Controller/AccountsController.php
index be3947fbb..893a750d7 100644
--- a/lib/Controller/AccountsController.php
+++ b/lib/Controller/AccountsController.php
@@ -35,6 +35,7 @@ use OCA\Mail\Contracts\IMailManager;
use OCA\Mail\Contracts\IMailTransmission;
use OCA\Mail\Db\Mailbox;
use OCA\Mail\Exception\ClientException;
+use OCA\Mail\Exception\ManyRecipientsException;
use OCA\Mail\Exception\ServiceException;
use OCA\Mail\Http\JsonResponse as MailJsonResponse;
use OCA\Mail\Model\NewMessageData;
@@ -383,7 +384,8 @@ class AccountsController extends Controller {
int $draftId = null,
int $messageId = null,
array $attachments = [],
- int $aliasId = null): JSONResponse {
+ int $aliasId = null,
+ bool $force = false): JSONResponse {
$account = $this->accountService->find($this->currentUserId, $id);
$alias = $aliasId ? $this->aliasesService->find($aliasId, $this->currentUserId) : null;
@@ -391,6 +393,11 @@ class AccountsController extends Controller {
$expandedCc = $this->groupsIntegration->expand($cc);
$expandedBcc = $this->groupsIntegration->expand($bcc);
+ $count = substr_count($expandedTo, ',') + substr_count($expandedCc, ',');
+ if (!$force && $count >= 10) {
+ throw new ManyRecipientsException();
+ }
+
$messageData = NewMessageData::fromRequest($account, $expandedTo, $expandedCc, $expandedBcc, $subject, $body, $attachments, $isHtml, $requestMdn);
$repliedMessageData = null;
if ($messageId !== null) {