Skip to content

Commit

Permalink
Plugin to block RCPT_TO addresses in a list.
Browse files Browse the repository at this point in the history
  • Loading branch information
godsflaw committed Sep 8, 2011
1 parent 8a4e623 commit 6633dcc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/rcpt_to.blocklist
@@ -0,0 +1 @@
# This is a blocklist for the rcpt_to line. One address per line.
11 changes: 11 additions & 0 deletions docs/plugins/rcpt_to.blocklist.md
@@ -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.
11 changes: 11 additions & 0 deletions plugins/rcpt_to.blocklist.js
@@ -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.