Trying to send email without getting the username and password prompt
Able to send email with prompt for password BUT want to get rid of the password prompt.
$Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName,$Password
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject -Body $Body -BodyAsHtml -SmtpServer $SMTPServer -Port $SMTPPort -UseSsl -credential $cred -Attachments $Attachment
Error : New-Object : Cannot find an overload for “PSCredential” and the argument count: “2”.