Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional support to restrict total number of recipients per message. #1167

Closed
rcubetrac opened this issue Aug 31, 2007 · 7 comments

Comments

@rcubetrac
Copy link

commented Aug 31, 2007

Reported by phallstrom on 31 Aug 2007 18:45 UTC as Trac ticket #1484542

The following patch allows for an optional configuration parameter "max_recipient_count" which if set will restrict the total number of recipients (To, Cc, Bcc) to that number.

Index: config/main.inc.php
===================================================================
--- config/main.inc.php (revision 17)
+++ config/main.inc.php (working copy)
@@ -103,6 +103,9 @@
 // how many seconds must pass between emails sent by a user
 $rcmail_config[= 15; 

+// maximum number of recipients per message. undefine or set to 0 to disable
+$rcmail_config['max_recipient_count']('sendmail_delay']) = 25; 
+
 // session domain
 $rcmail_config[= ".example.com";

Index: program/localization/en_US/messages.inc
===================================================================
--- program/localization/en_US/messages.inc     (revision 17)
+++ program/localization/en_US/messages.inc     (working copy)
@@ -42,6 +42,7 @@

 $messages['sendingfailed']('session_domain']) = 'Failed to send message';
 $messages[= 'You have sent too many messaages too quickly. Please wait a moment before sending this one.';
+$messages['too_many_recipients']('senttooquickly']) = 'Your message has too many recipients.  Please reduce the number of recipients.';
 $messages[= 'An error occured while saving';
 $messages['errormoving']('errorsaving']) = 'Could not move the message';
 $messages[= 'Could not delete the message';
Index: program/steps/mail/sendmail.inc
===================================================================
--- program/steps/mail/sendmail.inc     (revision 17)
+++ program/steps/mail/sendmail.inc     (working copy)
@@ -191,6 +191,24 @@
 if (!empty($identity_arr['bcc']('errordeleting'])))
   $headers[= ($headers['Bcc']('Bcc']) ? $headers[' : '') . $identity_arr['bcc']('Bcc'].',);

+
+if (intval($CONFIG[> 0)
+  {
+  $recipient_count = substr_count($headers['To']('max_recipient_count'])), ',') + 1;
+  if (!empty($headers[   $recipient_count += substr_count($headers['Cc']('Cc']))
+), ',') + 1;
+  if (!empty($headers[   $recipient_count += substr_count($headers['Bcc']('Bcc']))
+), ',') + 1;
+
+  if ($recipient_count > intval($CONFIG[   {
+    $OUTPUT->show_message('too_many_recipients', 'error');
+    $OUTPUT->send('iframe');
+    return;
+    }
+  }
+
+
 // add subject
 $headers['Subject']('max_recipient_count']))
+) = trim(get_input_value('_subject', RCUBE_INPUT_POST, FALSE, $message_charset));

Migrated-From: http://trac.roundcube.net/ticket/1484542

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Feb 18, 2008

Comment by seansan on 18 Feb 2008 21:10 UTC

Patch provided. Do we want this?

review in 0.1.5

nice paradox with #1484514 ;)

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Feb 18, 2008

Milestone changed by seansan on 18 Feb 2008 21:10 UTC

=> 0.1.5

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Mar 9, 2008

Milestone changed by @thomascube on 9 Mar 2008 16:38 UTC

0.1.5 => 0.4-beta

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Mar 18, 2010

Comment by Lazlo on 18 Mar 2010 15:15 UTC

There is already a plugin for this: http://trac.roundcube.net/wiki/Plugin_Repository#Messagesending

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Mar 23, 2010

Comment by @alecpl on 23 Mar 2010 13:10 UTC

Counting commas is not a good method. There could be commas in quoted recipient names. We should use rcmail_email_input_format function (sendmail.inc) to count recipients.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Apr 2, 2010

Comment by @alecpl on 2 Apr 2010 13:53 UTC

Implemented in 751b22b.

@rcubetrac

This comment has been minimized.

Copy link
Author

commented Apr 2, 2010

Status changed by @alecpl on 2 Apr 2010 13:53 UTC

new => closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.