LUC
Thanks for your example. This works properly. Attachment is txt file, I use notepad.
If I want to copy the contain of $Filename under the body of the mail, how can I process ?
I tried to use the parameter -body or -bodyAsHtml I got an error message
Send-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'Body'. Specified method is not supported.
At D:\support\Scripts\Resource_Pool_amavcs01\Test.ps1:225 char:17
+ Send-MailMessage <<<< -From $EmailFrom -To $EmailTo -Subject $EmailSubject -SmtpServer $SMTPSRV -BodyAsHtml $MyReport -Attachments $Filename1
+ CategoryInfo : InvalidArgument: (:smileyhappy: , ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.SendMailMessage
$MyReport = (get-content $Filename)
To format properly the contains of Transcript to readable notepad document
::Join("`r`n",(Get-Content $Filename)) | Out-File $Filename
$MyReport = (get-content $Filename)
Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $EmailSubject -SmtpServer $SMTPSRV -BodyAsHtml $MyReport -Attachments $Filename1
JEFF