I have his code to email a report that is gernerated on a weelky basis:
$Date= Get-Date
$EmailFrom = "sender@url.com"
$EmailTo = receiver@url.com
$Subject = “Report”
$Body = “Created on $Date”
$File = “C:temptest.txt”
$Msg = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo , $Subject, $Body
$Attachment = New-Object System.Net.Mail.Attachment $File
$Msg.Attachments.Add($Attachment)
$SMTPServer = “email_hosted_SMTP_server”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = $Ecreds
$SMTPClient.Send($Msg)
“““““““““““““““““““““
In testing it worked great on my Win7 Pro box but from the server it get the following message in powershell
"exception calling "Send" with "1" argument the remote certificate is invalid according to the validation process"
what did I do wrong?