##Created By Alberto Igbinedion
#.SYNOPSIS
#Sends SMTP email via the Hub Transport server
#
#.EXAMPLE
#.\SendTestMail.ps1 -To "Alberto.Igbinedion@ons.gov.uk" -Subject "Test email" -Body "This is a test" OR
# SendTestMail -To "Alberto.Igbinedion@ons.gov.uk" -Subject "Test email" -Body "This is a test"

Function SendTestMail {

param(
[string]$to,
[string]$subject,
[string]$body
)

$smtpServer = "oa.ons.gov.uk"
$smtpFrom = "Alberto.Igbinedion@ons.gov.uk.uk"
$smtpTo = $to
$messageSubject = $subject
$messageBody = $body

$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($smtpFrom,$smtpTo,$messagesubject,$messagebody)
}