Testing & Debugging =================== 1. Viewing Route / Action Logs ------------------------------ After an email enters the system and matches a Route, you can trace its processing through the **Logs** section. Route Logs ^^^^^^^^^^ - **Triggered Time**: The timestamp when the Route was executed. - **Route Name**: Indicates which Route was triggered. - **Overall Result**: `Success`, `Failed`, or `Quarantined`. If any Action under the Route fails, the whole Route is marked as `Failed`. - **Email Content**: Click to view the subject, sender, recipient, and body of the triggered email. - **Detailed Execution Logs**: Click **View Details** to expand logs for each Action executed in the Route. Action Logs ^^^^^^^^^^^ - **Execution Time**: The actual time the Action was executed. - **Action Type**: E.g., SMTP, API, JS, LLM, Telegram, etc. - **Result**: Whether the Action succeeded or failed. Includes HTTP response code or error message (if applicable). - **Log Details**: Logs the full internal handling of the Action, including request payloads, response body, exceptions, etc. Debugging Tips ^^^^^^^^^^^^^^ - **Reproduce the Issue**: Replay the test using the same email to confirm if the issue is reproducible. - **Check Variable Substitution**: Ensure placeholders like ``$BODY``, ``$SUBJECT``, ``$ATTACHMENT`` are correctly rendered. - **Isolate the Issue**: Temporarily disable unrelated Routes or Actions to narrow down the source of the error. - **Compare Raw Email**: Use the Route Log view to inspect the original email for any anomalies. 2. Test Suite for Rule / Action / Route --------------------------------------- Before using your configuration in production, it's highly recommended to test each **Rule**, **Action**, and **Route** to ensure correct logic and parameter setup. Preparing a Test Email ^^^^^^^^^^^^^^^^^^^^^^ MailTrigger supports three methods for generating test emails: - **Manual Input** Enter sender, recipient, subject, and body manually in the test interface. - **Upload `.eml` File** Upload a standard RFC-822 `.eml` file. MailTrigger will parse it and use it for testing. - **Forward a Real Email** Forward a real email to your MailTrigger mailbox (e.g., ``Bob@mailtrigger.app``). The system will automatically parse and register it as a test message. Running the Test ^^^^^^^^^^^^^^^^ 1. In the **Rule**, **Action**, or **Route** list view, click the **Test** button on the right-hand side. 2. Choose a previously prepared test email. 3. MailTrigger will show inline results for each test: - **Rule**: Whether the condition matches (`True` / `False`) - **Action**: Output content or modified email attributes - **Route**: Overall status (`Success` / `Failure`) and detailed execution logs per Action .. note:: Tests involving external systems (e.g., sending real SMTP emails, calling Webhooks, pushing Telegram messages) will be **executed for real** to validate complete delivery paths.