Hi,
I feel I have tried every which way to set the body of an email with the contents of two files, but not getting the expected result.
I retrieve the content of each file and set the content of this data to a file called body.txt:
get-content “C:\scripts\output\ $(get-date -f “MM_dd_yyyy”)_US.txt” | Add-Content c:\scripts\output\body.txt
get-content “C:\scripts\output\ $(get-date -f “MM_dd_yyyy”)_MEX.txt” | Add-content c:\scripts\output\body.txt
The file body.txt, if I open it in notepad, clearly shows CRLF at the end of each line. I then set the variable $body to a string by doing the following:
$body = (get-content -path c:\scripts\output\body.txt) | out-string
When I then try to email using send-mailmessage -body $body … the body of the email contains all of my lines in one long string. I know the out-string does this, but the send-mailmessage requires the info to be a string.
I will bet I am doing WAY too much manipulation of the data …
Would someone please give me a suggestion?
Thanks!