By default the mdadm will monitor all MD (multi-disk) arrays on your system and will send a message to the root user whenever a problem occurs.
Obviously, we want these messages to be sent by email to the system administrator, so we need a MTA (Message Transfer Agent) to send the mail from our system to a mail hub. We normally use sSMTP as a simple MTA. You can follow this tutorial to install it on your system
Open the mdadm configuration file.
# vi /etc/mdadm/mdadm.conf
And simply change the “MAILADDR” and MAILFROM” to instruct the monitoring daemon where to send mail alerts.
MAILADDR email@example.com MAILFROM firstname.lastname@example.org
Change the highlighted items with your own credentials.
Now test your configuration.
# mdadm --monitor --scan --test -1
If all works well, you should now receive a separate mail for each raid array that is active on your server. From now on, you will be alerted if any problem occurs, e.g. hard drive failure.