How to configure conditional smart relay with sendmail on Rocky Linux 8
Rocky Linux 8 with sendmail hosting multiple domains works fine. Only one domain should be configured to use a smarthost with a third party anti-spam service. We want to prevent that every e-mail will be relayed to one external smart host, all other e-mails should go out directly.
- Create a smarttable file.
# touch /etc/mail/smarttable
- Download smarttable.m4 and copy the file to /usr/share/sendmail-cf/feature/
# cd /usr/share/sendmail-cf/feature/ # wget http://jmaimon.com/sendmail/anfi.homeunix.net/sendmail/smarttable.m4
- Add following entry to your sendmail.cf file.
FEATURE(`smarttable')dnl
- Rebuild the sendmail config
# /etc/mail/make # service sendmail restart
- Create your smarttable
# cat /etc/mail/smarttable @domain-a.com relay-cluster-eu01.hornetsecurity.com @domain-b.com relay-cluster-us01.hornetsecurity.com
- Rebuild smartable by using makemap
# makemap hash /etc/mail/smarttable < /etc/mail/smarttable