Do you want your OpenIndiana instance to let you know when something has gone wrong or if a
cron job has failed? Here's how you do it.
First, tell the operating system to email you if anything goes into the maintenance, offline, or degraded states:
# svccfg setnotify -g to-maintenance,to-offline,to-degraded mailto:YourEmailAddress
cron jobs and the like, add the following lines to
root: YourEmailAddress YourUsername: YourEmailAddress
Ensure there are no other conflicting
YourUsername definitions (read: lines beginning with either of those.) If there are, either comment them out or resolve the conflicts using the commented instructions in the file.
/etc/mail/aliases when you're done editing, then run the following in the terminal:
Now test your config by sending an email directly to
YourEmailAddress¹, checking its inbox each time:
echo "This is the body of the email" | mail -s "This is the subject line" YourEmailAddress
Then try sending an email to
echo "This is the body of the email" | mail -s "This is the subject line" root
Finally, try sending an email to
echo "This is the body of the email" | mail -s "This is the subject line" YourUsername
Those should all work.
¹ The emails I sent using this method did not have a subject line, so the
-s might not work OpenIndiana. To be honest, I stole this line from Debian tutorial, so 🤷♂️. In any case, automated emails will have their own programmatically generated subject lines and bodies.