FreeBSD – Sendmail – Static relay

This is something I’m gonna forget, and as I use this blog as my personal notebook, I need to document this.

I’ve had strange issues not being able to send mail from my web server, to a specific domain. Been troubleshooting with the hosting company, and they have tried to whitelist me, but without any luck. They do however have another smtp server witch does not include the same spam filter. But how can I redirect traffic there, without changing public DNS?

Force sendmail to static relay to host for a spesfict domain.


root@xxx:/etc/mail # cat mailertable
# $FreeBSD: releng/10.1/etc/mail/mailertable.sample 58193 2000-03-18 06:38:23Z rwatson $
#
# List of domains (possibly wildcarded) and destination mailers
#
static-domain.com smtp:smtp.somemailserver.com

After modifying the file, run a “make” withing the /etc/mail directory.


root@xxx:/etc/mail # make
...
/usr/sbin/makemap hash mailertable.db < mailertable chmod 0640 mailertable.db

Perfect, looking at /var/log/maillog I can now see that the email is forward directly to my static relay server.

Leave a Comments