Solved

Powershell email - Need to have caarrage returns

Posted on 2014-03-05
2
208 Views
Last Modified: 2014-03-06
The email works but everything is run together. I need a new line at the end of both test lines, some lines in between the two sets and new lines for each line in the txt files.

Any suggestions?


-BodyAsHtml `
    -Body  @"
      The Following Were tested and are up and can be logged into
     $(((Get-Content C:\MonitorFolder\ServersUp.txt) | out-string)
      
      
       "The Following Were tested and are either DOWN or CANNOT be logged into"
       ((Get-Content C:\MonitorFolder\ServersDown.txt) | out-string))
"@
0
Comment
Question by:jimmylew52
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 39908198
Either don't use the the -BodyAsHtml switch parameter, or remember that when you do use it your email is HTML and needs to be formatted accordingly.
An example with:
-BodyAsHtml `
    -Body  @"
      The Following Were tested and are up and can be logged into<br>
     $((Get-Content C:\MonitorFolder\ServersUp.txt) -join "<br>")
       <p>
       The Following Were tested and are either DOWN or CANNOT be logged into<br>
       $((Get-Content C:\MonitorFolder\ServersDown.txt) -join "<br>")
"@ 

Open in new window

0
 
LVL 1

Author Comment

by:jimmylew52
ID: 39909127
That worked. Thank You!!!!
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A procedure for exporting installed hotfix details of remote computers using powershell
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question