Skip to content

Instantly share code, notes, and snippets.

exports.hook_data = function (next, connection) {
var me = this
var txn = connection.transaction;
connection.transaction.parse_body = 1; // enable mail body parsing
txn.notes.attachment_count = 0;
function start_attachment(connection, ctype, filename, body, stream) {
var txn = connection.transaction;
txn.notes.attachment_count++;
server.notes.getdomain = function(domain, callback){
callback(null)
}
async.waterfall([server.notes.getdomain(dest_domain)], function (err, domain) {
if(err){
next(SOFTDENY ,'Error geting domain settings, please try again later')
}else{
if(domain.receiving===1){
me.loginfo("ACCEPTING DOMAIN: "+dest_domain);
next()
}else{
me.loginfo("DENYING DOMAIN: "+dest_domain);
next(DENY ,'Denied, not accepting mail here. fresh')