Send-MailMessage – Message Body content formatting

Welcome Forums General PowerShell Q&A Send-MailMessage – Message Body content formatting

Viewing 7 reply threads
  • Author
    Posts
    • #264947
      Inactive
      Topics: 7
      Replies: 17
      Points: 0
      Rank: Member

      EDITED:

      Hi PoshFam – I’m trying to automate a process in which we pull multiple csv files reflecting data usage for our mobile community. I have portion to obtain the data and am having an issue with representing the csv file locations in the email correspondence notifying of script completion. (Pls. see next post for function)

      All is well and the script runs however the output is not that of what I was envisioning.

      Results would be as shown:

      URL1 URL2 URL3

      When the recipient receives the email mail body the structure is as follows:

      • Email shows all csv’s attached = Expected
      • HTML heading appears in the boy = Expected
      • Under “File attachment summary the csv locations are truncated and not showing up as a (one after the other) instead just one continuous string.

      When getting the URL from $final_list is ran on the console the URLs of the files show up in list format.

      URL1

      URL2

      URL3

      I am not sure as to the formatting that I need in order for the email to show the proper formatting as it displays on the PS console.

      Any guidance/assistance would be much appreciated.

      Thanks,

      Alex

       

      • This topic was modified 1 month, 1 week ago by grokkit.
      • This topic was modified 1 month, 1 week ago by grokkit.
    • #264953
      Inactive
      Topics: 7
      Replies: 17
      Points: 0
      Rank: Member

      Not sure why it didn’t copy the entire function before:

    • #265004
      Senior Moderator
      Topics: 10
      Replies: 196
      Points: 1,051
      Helping Hand
      Rank: Community Hero

      Your script was not displaying correctly due to the backticks being used to escape the quotation marks on line 37.

    • #265025
      Participant
      Topics: 0
      Replies: 5
      Points: 9
      Rank: Member

      Use the following code instead of Param. It is easy in this way.

      Send-MailMessage -From “” -To “” -Subject “” -Body “” -Attachments

      Reference:

      https://www.powershellguru.com/other

    • #265040
      Inactive
      Topics: 7
      Replies: 17
      Points: 0
      Rank: Member

      @grokkit – Sorry for neglecting the backticks

      @dhrubbharali20 – the param method works as I am able to send the email and with the attachments, however the issue is the presentation of the file URLs in the mail body.

      Instead of having the URLs listed right after one another, they are being truncated and appearing to be on one line versus a row of lines.

      Appreciate the feedback nonetheless.

    • #265220
      Participant
      Topics: 9
      Replies: 677
      Points: 2,680
      Helping Hand
      Rank: Community Hero

      I would remove the format-list, those are specifically for the display at the console.

    • #265259
      Inactive
      Topics: 7
      Replies: 17
      Points: 0
      Rank: Member

      @Doug, Appreciate the feed back. I have removed and still the same mail content output.

      Looking at approaching via another method.

    • #265349
      Inactive
      Topics: 7
      Replies: 17
      Points: 0
      Rank: Member

      Thanks all for the feedback.

      I have gone ahead and went w/the HTML w/CSS mail content approach.

      Consider this thread archived.

Viewing 7 reply threads
  • You must be logged in to reply to this topic.