Restrict Senders plugin for SquirrelMail
========================================
Ver 1.0, 10/25/03

Original author: Paul Lesneiwski <pdontthink@angrynerds.com>


Description
===========

This plugin allows you to place restrictions on the destination
addresses of all outgoing email (only email that is sent using 
Squirrelmail).  You may restrict the total number of recipients
for all outgoing emails (an anti-spam tactic) or you may restrict 
the domains to which your users are allowed or disallowed to 
send mail to.  Recipient domain restrictions may be defined on a 
per-user or per-domain basis, or for all of your users.

Please note that this plugin is a poor replacement for real SMTP
filtering, which provides the same functionality no matter what
email client your users are using (it will also be much faster).
This plugin will work ONLY for email sent using SquirrelMail.
For just one good example of how to do this kind of filtering with
your SMTP server (Postfix), see:

http://www.stahl.bau.tu-bs.de/~hildeb/postfix/postfix_restriction_classes2.shtml

Note that for better performance, recipient domain restrictions
are cached in the user's session.  Thus, if you are adjusting 
and testing your restriction rules, you'll need to log out and
back in again to see each change take effect.

If you want your users to have a visual indication of what 
recipient addresses were allowed/blocked when they send email,
you should download and install the sent_confirmation plugin,
which, as of version 1.2, is compatible with this plugin.



Configuration
=============

  data/config.php
  ===============

  $restrictNumberOfRecipients
  ---------------------------
  can be set to the total number of outgoing addresses 
  (including CC: and BCC: addresses) that are allowed for 
  any one email.  Set this to zero to turn off this 
  functionality (allows unlimited number of recipients).

  Note that you may specify override values for the 
  $restrictNumberOfRecipients setting in the "Virtual Host 
  Login" (vlogin) plugin if you are using that by specifying 
  the "vlogin_restrictNumberOfRecipients" setting in the 
  vlogin configuration.  This may only work if vlogin is 
  listed before restrict_senders in your plugin order in
  config/config.php or config/conf.pl.

  $restrictNumberOfEmailsPerDay
  -----------------------------
  can be set to the maximum number of outgoing emails that 
  may be sent by any one user in any one day.  Set this to 
  zero to allow unlimited number of emails to be sent.
 
  Note that you may specify override values for this in the
  "Virtual Host Login" (vlogin) plugin if you are using that
  by specifying the "vlogin_restrictNumberOfEmailsPerDay" setting
  in the vlogin configuration.

  $restrictDomains
  ----------------
  is the on/off switch for the functionality that checks your 
  custom recipient domain restrictions (defined as indicated 
  below).  Set to zero if you are only restricting the total 
  number of email recipients.  Set to 1 if you do any of the 
  following...


  data/send_restrictions.dat
  ==========================

  Detailed instructions for configuring this file are included 
  in the send_restrictions.dat.sample file, but here is an
  overview and some things to keep in mind:

  You may define domains that are allowable or disallowable 
  for outgoing email in a very flexible manner.  You may 
  define these rules for just some or all of your users,
  for just some or all of the domains you may host, or for
  everyone who uses SquirrelMail to send email.

  Note that you can specify the users and domains these rules
  apply to explicitly, or in groups by using wildcards.  Also
  note that every set of rules can be made up of multiple
  allowable AND/OR disallowable domains, as well as a default
  ("allow" or "deny") for any domains that didn't match.  There
  is also a default allow/deny directive at the end of the file
  that catches all email sent by users and domains for which 
  you have not defined any rules.  Finally, it is important to
  understand that the first matching rule always wins, and any
  rules after that are ignored.



Future Work
===========

   *  Ideas?



Change Log
==========

  1.1 - 2005/04/16 - Paul Lesneiwski <pdontthink@angrynerds.com>
   * Added ability to use vlogin to override $restrictNumberOfRecipients
     setting (use "vlogin_restrictNumberOfRecipients" in vlogin).
     This may only work if vlogin is listed before restrict_senders in 
     your plugin order.
   * Added ability to restrict number of emails sent per day (also
     can be overridden by vlogin with "vlogin_restrictNumberOfEmailsPerDay")
   * Internationalization updates (correct bind calls; locale is
     in SquirrelMail locale directory)

  1.0 -  Paul Lesneiwski <pdontthink@angrynerds.com>
   * Initial release



