Email notifications using Msmtp in FreeNAS

Last modified: Mar. 22, 2010

1 - Summary
2 - Msmtp configuration
3 - Example shell script

1 - Summary

This guide will show how to send emails for system events using msmtp in
FreeNAS. Msmtp is an SMTP client using to send email. This has been tested in

2 - Msmtp configuration

Log into the website interface and go to the System menu and select Advanced.
Click on the Email tab and type in the configuration information. Here is some
example information.
  Outgoing mail server:
  Port: 25
  Security: None
  From email:
After typing in the information, click on Save.

3 - Example shell script

Here is an example shell script that sends an email.


host=`$hostname -s`
current_day=`$date +%m/%d/%y`
current_time=`$date +%H:%M:%S`
from="Test <>"

body="This is a test."
subject="Test sent from $host [$current_day $current_time]"
$printf "From: $from\nTo: $recipient\nSubject: $subject\n\n$body" | $msmtp --file=$msmtp_config -t
exit 0

Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2018.