Here’s a guide to setting up a FreeBSD server to relay emails for a set of IP addresses and/or hostnames. Be very careful to only enable relaying for trusted machines. Ideally, you’d setup your FreeBSD sendmail server to require authentication.
- Enable sendmail on your FreeBSD server by adding the following line to the /etc/rc.conf file:
- Start sendmail using FreeBSD’s rc.d system.
- Add the IP address or IP addresses that you’d like sendmail to relay mail for to the /etc/mail/access file. For example, the following lines enable relaying for all emails coming from 10.0.2.1, and any IP address starting with 192.168.0.
- cd to your FreeBSD server’s /etc/mail directory, and run make to apply your changes to sendmail.
sendmail_enable="YES"
/etc/rc.d/sendmail start
10.0.2.1 RELAY
192.168.0 RELAY
cd /etc/mail
make