Overview
By default, when Amavis rejects an email due to exceeding the configured spam kill level, it returns a generic response:
554 5.7.0 Reject, id=27440-12 - spam (in reply to end of DATA command)
This article provides instructions for customizing this rejection message with a more descriptive policy-based response on supported Linux distributions.
Prerequisites
- Root or sudo access to the mail server
- Amavis installed and actively processing mail
Procedure
To modify the spam rejection response, complete the following steps:
- Open the appropriate configuration file for your operating system using a text editor:
- AlmaLinux/CloudLinux/RHEL: /etc/amavisd/warden.conf
- Debian/Ubuntu: /etc/amavis/conf.d/99-warden
- Add the following configuration line to the file:
$smtp_reason_by_ccat{&CC_SPAM} = 'id=%n - rejected for policy reasons'; - Save and close the configuration file.
- Restart the Amavis service to apply the changes:
- AlmaLinux/CloudLinux/RHEL:
systemctl restart amavisd - Debian/Ubuntu:
systemctl restart amavis
- AlmaLinux/CloudLinux/RHEL:
Troubleshooting
If the custom rejection message does not appear after restarting the service, verify the following:
- Confirm that the configuration file was saved correctly and contains no syntax errors.
- Check the Amavis service status to ensure it restarted successfully without errors.