How mindbaz/zonemta-block-zone works
Project type and purpose
• This is a Node.js plugin module for ZoneMTA (an SMTP server framework) that blocks mail delivery to specific “zones” or domains.
• It is not a standalone full-stack app but an extension module that ZoneMTA loads at runtime.
File structure
• Root files:
• package.json / index.js — the entry point and module metadata
• config.example.toml / config.toml — plugin-specific configuration
• Makefile / LICENSE / README.md — build, license, and documentation
• tests/ directory: unit tests for each core function (get_receiver_domain, is_receiver_domain_blocked, raise_error, init)
README for insights
• Usage: installed as a dependency, enabled in ZoneMTA’s “plugins” section with type “receiver”
• Configuration: array of zone names to block
• Workflow: ZoneMTA calls the plugin’s hook on each incoming recipient, the plugin inspects the domain, and throws an error if it’s in the blocked list.
Components
a. Main components
• ZoneMTA Core (SMTP engine, plugin loader)
• zonemta-block-msp Plugin
– init() hook registration
– get_receiver_domain()
– is_receiver_domain_blocked()
– raise_error()
• Plugin Configuration (TOML file)
• Tests harness (Mocha/Jest or similar test runner) – optional, for completeness
b. Relationships & interactions
• SMTP flow → ZoneMTA Core
• Core invokes Plugin.init() at startup
• For each recipient:
– Core → Plugin.get_receiver_domain(input envelope)
– Domain returned → Plugin.is_receiver_domain_blocked(config.zone_block)
– If blocked → Plugin.raise_error() → ZoneMTA rejects delivery
• Config.toml is read by the plugin at init time
c. Architectural patterns / design principles
• Hook-based plugin architecture (observer pattern)
• Single-responsibility functions (each exported function does one thing)
• Configuration-driven behavior
d. Key technologies & libraries
• Node.js module system (CommonJS exports in index.js)
• zone-mta plugin API (receiver hook)
• toml parser (reads config.toml)
• test framework (e.g., Mocha) for unit tests