Geek Projects – Linux, Apache, MySQL, PHP, DNS A Linux Sysadmin

May 6, 2008

SMTP relay with FreeBSD and sendmail

Filed under: Systems Administration — Matt @ 10:42 pm

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.

  1. Enable sendmail on your FreeBSD server by adding the following line to the /etc/rc.conf file:
  2. sendmail_enable="YES"

  3. Start sendmail using FreeBSD’s rc.d system.
  4. /etc/rc.d/sendmail start

  5. 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.
  6. 10.0.2.1 RELAY
    192.168.0 RELAY

  7. cd to your FreeBSD server’s /etc/mail directory, and run make to apply your changes to sendmail.
  8. cd /etc/mail
    make

Powered by WordPress