logger plugin provides visibility into SMTP server activity by logging each SMTP phase to the console. This is useful for debugging, monitoring, and auditing email traffic.
What It Does
The logger plugin hooks into key SMTP lifecycle events and outputs information about:- New client connections
- MAIL FROM commands (sender addresses)
- RCPT TO commands (recipient addresses)
- Connection closures
Function Signature
logger function takes no parameters and returns a Fumi plugin.
Usage
Import and use the logger plugin in your Fumi application:Example Output
When a client connects and sends an email, you’ll see output like:Implementation
The logger plugin hooks into four lifecycle events:The logger plugin writes to
stdout using console.log. In production environments, consider redirecting output to a file or using a more sophisticated logging solution.Use Cases
- Development: Monitor SMTP traffic during local development
- Debugging: Trace connection and command flow to diagnose issues
- Auditing: Keep simple logs of email activity
- Testing: Verify that your SMTP server is receiving expected commands