måndag, juni 11, 2007

SSMTP, forward mail to smarthost in FreeBSD

SSMTP works (great) only for outgoing mail.
" Mail is simply forwarded to the configured mailhost.
It does not receive mail, expand aliases or manage a queue. "

Let's say you have some loghost, who should not be able to recieve mail- SSMTP works great.
Sendmail only binds to 127.0.0.1:25 default, but disable it still reduces listening ports- I like that..

Pre req:
Update FreeBSD Ports with portsnap..

Now the Action,

freebsd62# cd /usr/ports/mail/ssmtp
freebsd62# make install clean
freebsd62# cd /usr/local/etc/ssmtp
freebsd62# ls
revaliases.sample ssmtp.conf.samplemonitor
freebsd62# cp revaliases.sample revaliasesmonitor
freebsd62# cp ssmtp.conf.sample ssmtp.confmonitor
freebsd62# ls
revaliases revaliases.sample ssmtp.conf ssmtp.conf.sample
freebsd62#vi /usr/local/etc/ssmtp/ssmtp.conf

mail=mail.domain.com
rewriteDomain=domain.com
hostname=freebsd62.domain.com

# vi /etc/rc.conf
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

Test
mail -s "Testing" your.address@domain.com