Simulate SMTP failures
Test how your application handles SMTP errors. Simulate temporary and permanent delivery failures for resilience testing.
The problem
Production SMTP servers occasionally fail, whether from rate limiting, temporary outages or configuration issues. Applications need to handle these failures gracefully, but testing error paths requires a way to trigger failures on demand.
How ammo.tools solves it
SMTP simulation mode makes the inbox reject incoming messages with configurable error responses. Test how your application handles temporary failures (retry logic) and permanent rejections (alerting, fallback behaviour).
Setup
- Open your inbox settings in the ammo.tools web interface.
- Under SMTP Simulation, select a failure mode:
- Temporary failure: Returns 451 (try again later)
- Permanent rejection: Returns 550 (message rejected)
- Save the settings. The simulation is active for 15 minutes.
- Send emails from your application and observe the error handling.
Enable simulation via API
curl -X POST -H "Authorization: Bearer $AMMO_TOOLS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mode": "temporary"}' \
"https://app.ammo.tools/api/v1/inboxes/INB_ID/smtp-simulation"
Modes: off, temporary, permanent
SMTP responses
- Temporary (451):
451 4.3.0 Simulated temporary failure; retry later - Permanent (550):
550 5.7.1 Simulated permanent rejection
Testing retry logic
Use temporary failure mode to verify your application:
- Queues failed messages for retry
- Uses appropriate backoff intervals
- Eventually delivers after the simulation expires
- Alerts operators after repeated failures
Testing permanent rejection handling
Use permanent rejection mode to verify your application:
- Logs the failure appropriately
- Does not retry indefinitely
- Notifies users or administrators
- Falls back to alternative notification methods if configured
Things to know
- Simulation mode automatically expires after 15 minutes.
- The inbox returns to normal capture mode when simulation ends.
- Simulation affects all SMTP connections to the inbox.
- Messages rejected during simulation are not captured.
- Use separate inboxes for simulation to avoid disrupting other testing.