When in doubt, read the documentation
BodyAsHtml is a boolean value indicating whether or not the body contains HTML. You still need to pass the actual body via the Body parameter. Change this:
$EmailParams = @{
To = $To
Cc = $Cc
From = $From
Subject = $Subject
BodyAsHtml = $HTML
Priority = $Priority
SMTPServer = $SMTPserver
Attachments = $Attachment
ErrorAction = 'Stop'
}
into this:
$EmailParams = @{
To = $To
Cc = $Cc
From = $From
Subject = $Subject
Body = $HTML
BodyAsHtml = $true
Priority = $Priority
SMTPServer = $SMTPserver
Attachments = $Attachment
ErrorAction = 'Stop'
}
De acá: https://stackoverflow.com/questions/25969607/powershell-send-mailmessage-bodyashtml-wrong-type