Skip to main content

Name

vctx:disconnect — Disconnect the session associated with the current validation context

Synopsis

vctx:disconnect(code, message);

code: string
message: string

Description

This function disconnects the current session associated with the validation context. Pass in a code and a message. Use this function in the following way:

require("msys.core");
require("msys.extended.message");
require("msys.extended.vctx");

local mod = {};

function mod:validate_mailfrom(str, accept, vctx)
  str = tostring(str);
  if (string.find(str, "disconnect@example.com") != nil) then
    print("Disconnecting " .. str);
    vctx:disconnect(421, "Go away dude");
  return msys.core.VALIDATE_DONE;
end

return msys.core.VALIDATE_CONT;
end

msys.registerModule("vctx_disconnect", mod);

Because this function is in the msys.core namespace, an explicit require('msys.core') is not necessary.

Was this page helpful?