SQL Agent Job Notification – Email Without Configuring Database Mail

sql-server-2012sql-server-agent

Is there any way to send sql agent job notification email without configuring Database Mail?

Currently I am using Database Mail but due to security concern, i need to disable Database Mail feature.

Thanks.

Best Answer

You can easily invoke a Powershell script: (Change the FromEmailAddress, ToEmailAddress and SmtpClient information)

$computerName = gc env:computername
$emailFrom = $computerName + “<EmailFromAddress>.com”
$emailTo = "<EmailToAddress>.com"
$subject = "Testing email"
$emailBody = "This is an example of sending email via Powershell"
$message = New-Object Net.Mail.MailMessage($emailFrom, $emailTo, $subject, $emailbody)
$message.Priority = "HIGH"
$smtpServer = "<YourSmtpServer>.com"
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)