Setup Sendmail Smart Relay in FreeBSD

It’s good that to route all your outgoing email to a relay server for centralize management. Compiling Sendmail’s Smart Relay options in FreeBSD is slightly different from Linux machine. But it’s fairly easy to do so. Just follow the steps below, and I assume you already have your own email relay server to relay to.

Go to /etc/mail
run “make” command for the first time to generate “yourdomain”.cf and “yourdomain”.submit.cf / “yourdomain”.mc and “yourdomain”.submit.mc file

After mc and mf files have generated. Edit .mc file, look for line below. Change the SMART HOST to your email server’s hostname. It must be hostname and you CAN’T configure IP Address for SMART HOST.

Next copy “define(SMART_HOST', relay.server.hostname’)” and paste it in “yourhostname”.submit.mc. It must be placed before the line of “msp” feature.

After configuration has been made, now run “make install” to generate the cf file and replace sendmail.cf and submit.cf

You are basically done, now. Just restart sendmail services.

Ignore the line to change sendmail_enable to YES if your server just do email submit and it doesn’t act as incoming email.