Exim Syntax Errors: Causes and Fixes
Exim is a popular mail transfer agent (MTA) used on Unix-like operating systems. Syntax errors in Exim typically occur when there are issues in its configuration file (exim.conf) or related files.
For other Exim / mail-stack debugging topics, see Fixing t_dkim_invalid (DKIM Signature Issue), Understanding dovecot_virtual_delivery, and "EHLO not accepted from server!" — Complete SMTP Error Fix.
Common Causes of Exim Syntax Errors
1. Misconfigured exim.conf File
Incorrect syntax in directives or parameters. Missing or misplaced sections.
2. Invalid ACL (Access Control List) Configuration
ACL rules in Exim are strict, and any misalignment can cause errors.
3. Incorrect Variable Usage
Using undefined or misconfigured variables.
4. Incorrect Formatting
Missing colons, semicolons, or indentation issues in configuration lines.
5. Updates or Incompatibility
Configuration files may break after an Exim version update.
6. Third-Party Modifications
Improper changes made by third-party plugins or scripts.
How to Troubleshoot and Resolve Syntax Errors
Check Exim Configuration
Run Exim built-in syntax checker to identify errors:
exim -bV
Alternative: Check the configuration file explicitly:
exim -C /etc/exim.conf -bV
This will display the configuration details and pinpoint any errors.
Debugging Configuration
Run Exim in debug mode to identify syntax or operational issues:
exim -d -bh 127.0.0.1
This will output detailed information about Exim operations.
Review the Error Logs
Check the Exim error logs for details about syntax or runtime issues:
tail -f /var/log/exim_mainlog
Other log files to check:
/var/log/exim_rejectlog/var/log/exim_paniclog
Correct Common Syntax Issues
Missing or Misplaced Colons
Exim directives often require a colon (:) to separate key-value pairs:
acl_check_data:
Ensure every directive has the correct syntax.
Indentation Issues
Some sections, especially ACLs, require proper indentation:
accept:
condition = ${if eq{$sender_address}{valid@example.com}{yes}{no}}
Check for consistent spaces or tabs.
Misconfigured Variables
Ensure that all variables (e.g., $domain, $sender_address) are defined correctly. For example:
- If using ${if}, confirm the conditional logic is valid.
ACL Errors
Errors in the ACL section are common. Ensure each block (e.g., accept, deny) is well-formed:
acl_check_rcpt:
deny:
condition = ${if eq{$sender_address}{blacklist@example.com}{yes}{no}}
accept:
Validate Updates
After updating Exim, ensure compatibility:
- Verify the Exim version:
- Check if the exim.conf file needs adjustments for the new version.
exim -bV
Revert to a Backup
If recent changes caused errors, revert to a working backup of exim.conf:
- Check for backups:
- Restore a previous version:
ls /etc/exim.conf.bak*
cp /etc/exim.conf.bak /etc/exim.conf
Regenerate the Configuration
If the file is too corrupted, regenerate it:
- Use a default configuration file provided by Exim:
- Customize it to suit your server needs.
cp /usr/share/doc/exim/examples/exim.conf /etc/exim.conf
Test Changes
After making corrections, restart Exim and test:
sudo systemctl restart exim
Verify functionality by sending test emails and checking for errors.
Preventing Syntax Errors
- Validate Configuration Changes:
- Always use
exim -bVto test changes before applying them.
- Always use
- Keep Backups:
- Backup the exim.conf file before making changes.
- Document Modifications:
- Maintain notes about changes for easier troubleshooting.
- Update Carefully:
- Review the changelog of Exim updates to ensure configuration compatibility.


