Announcement

Collapse
No announcement yet.

E-mail body being one line only

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • E-mail body being one line only

    Hi again all.

    I've done this code:

    Code:
    $message = New-Object System.Net.Mail.MailMessage($from, $to)
    $message.CC.Add($cc)
    $message.Subject = "System Information"
    $message.Body = $(Get-Content $body)
    $message.Attachments.Add($location)
    
    $smtpsend = New-Object System.Net.Mail.SMTPClient
    $smtpsend.Host = $mailserver
    $smtpsend.Send($message)
    Now, the attachment is fine but the body of the e-mail is coming out on just one line. It is just a normal text file. I assume it is to do with the line breaks but I haven't tried changing it. This is in PowerShell. Any help would be fantastic because this is driving me nuts .

  • #2
    Re: E-mail body being one line only

    So the problem is that you can't figure out how to wrap the text?

    Use html and insert your own formatting.

    Code:
    $message.IsBodyHtml = True
    Last edited by ahinson; 23rd October 2006, 16:35.
    Andrew

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: E-mail body being one line only

      I thought as much and tried it but the output still came out on one line. I had the output put in a <pre> tag which when viewed in a browser works fine but when sent via e-mail doesn't keep the formatting.

      Comment

      Working...
      X