Permalink
Browse files

Plugin to block RCPT_TO addresses in a list.

  • Loading branch information...
1 parent 8a4e623 commit 6633dcc8168ff0f332ad67abf1e2d22eb5e30e5e @godsflaw godsflaw committed Sep 8, 2011
Showing with 23 additions and 0 deletions.
  1. +1 −0 config/rcpt_to.blocklist
  2. +11 −0 docs/plugins/rcpt_to.blocklist.md
  3. +11 −0 plugins/rcpt_to.blocklist.js
View
@@ -0,0 +1 @@
+# This is a blocklist for the rcpt_to line. One address per line.
@@ -0,0 +1,11 @@
+rcpt_to.blocklist
+===================
+
+This mail blocks RCPT_TO addresses in a list.
+
+Configuration
+-------------
+
+* rcpt_to.blocklist
+
+ Contains a list of email addresses to block.
@@ -0,0 +1,11 @@
+// Block mail from matching anything in the list
+var utils = require('./utils');
+
+exports.hook_rcpt = function (next, connection, params) {
+ var rcpt_to = params[0].address();
+ var list = this.config.get('rcpt_to.blocklist', 'list');
+ if (utils.in_array(rcpt_to, list)) {
+ return next(DENY, "Mail to " + rcpt_to + "is not allowed here");
+ }
+ return next();
+}

0 comments on commit 6633dcc

Please sign in to comment.