uso_del_bodyashtml

This is an old revision of the document!


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

uso_del_bodyashtml.1682175389.txt.gz · Last modified: 2024/10/17 21:42 (external edit)