First, we need to create the Powershell script (Source from HowToGeek.com):
$EmailFrom = "emailID@emaildomain.com"
$EmailTo = "email@example.com"
$Subject = "The subject of your email"
$Body = "What do you want your email to say"
$SMTPServer = "smtp.email.server.address"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("usr", "pass");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
Then we need a script to invoke the powershell script
powershell & "C:\PathToPowerShellScript\myPowerShellEmailScript.ps1"
Finally, modify the service to execute a command on failure:
SC failure serviceName command="C:\PathToBat\MyScript.bat"