Sometime you want to automate health-checking of your server. You have created some script that check here and there, and send it to your email. Every morning when you come to office, you just sit there with a cup of coffee while reading email about the status of your server.

Solaris usually already have mail server, the good old sendmail. Sendmail start/stop script available at /etc/init.d/

To start sendmail
/etc/init.d/sendmail start

To stop sendmail
/etc/init.d/sendmail stop

Before you start sendmail, you have to change some configuration first. Uncomment DSmailhost$?m.$m$. at /etc/mail/sendmail.cf. The line should be look like this
# “Smart” relay host (may be null)
DSmailhost$?m.$m$.

Then change your /etc/hosts, add mailhost entry and point it to your office mail relay (MTA).

bash-3.00# more /etc/hosts
#
# Internet host table
#
10.1.1.1 mailhost

Where 10.1.1.1 is your mail relay.

To test you newly configured sendmail, type this:
/usr/lib/sendmail -v < /dev/null adiguna@gmail.com

You should see something like this if everything went right

#/usr/lib/sendmail -v < /dev/null adiguna@gmail.com
adiguna@gmail.com… Connecting to mailhost.net via relay…
220 JKTGRHXMAV01.x.x.x.x Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready atย  Thu, 18 Jan 2007 21:21:34 +0700
>>> EHLO m2000svr.net
250-JKTGRHXMAV01.x.x.x.x Hello [10.x.x.x]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM
250-AUTH GSSAPI NTLM
250-X-LINK2STATE
250-XEXCH50
250 OK
>>> MAIL From:<adiguna@m2000svr.net>
250 2.1.0 adiguna@m2000svr.net….Sender OK
>>> RCPT To:<adiguna@gmail.com>
250 2.1.5 adiguna@gmail.com
>>> DATA
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 2.6.0ย  <200701181421.l0IELYn09943@m2000svr.net> Queued mail for delivery
adiguna@gmail.com… Sent ( <200701181421.l0IELYn09943@m2000svr.net> Queued mail for delivery)
Closing connection to mailhost.net
>>> QUIT
221 2.0.0 JKTGRHXMAV01.x.x.x.x Service closing transmission channel

Now you can check your email ๐Ÿ™‚