Embede multiple HTML files in e-mail body

This topic contains 5 replies, has 4 voices, and was last updated by  Paul Frankovich 2 years, 1 month ago.

  • Author
  • #38671

    Venkata Kalyan

    I have five HTML files & try to embed all these to e-mail body.
    Example below:

    E-mail body must look like below:

    The below contains D1 information
    Embed 1.HTML

    The below contains D2 information
    Embed 2.HTML

    I wrote a script, but it is not getting me the desired output:
    $body = get-content .\content.htm
    $message.body = $body


  • #38676

    random commandline

    Do you need the name of each html file in email body or the contents of each html file in email body?

  • #38678

    Dan Potter
    $a = ""
    $a = $a + "BODY{background-color:white;FONT-SIZE: 8pt; FONT-FAMILY: verdana}"
    $a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}"
    $a = $a + "TH{border-width: 1px;padding: 3px;border-style: solid;border-color: black;color: red;background-color:#CCCCCC}"
    $a = $a + "TD{border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color:white}"
    $a = $a + ""
    get-process |ConvertTo-HTML -head $a | out-file test.htm
    get-service |ConvertTo-HTML -head $a -body '' | out-file test.htm  -append
  • #38679

    Dan Potter

    There are supposed to be to html breaks in between the quoutes in the second command. forum removes them.

  • #38918

    Venkata Kalyan

    Thanks. Worked fine.


  • #38919

    Paul Frankovich

    Doesn't this literally make two separate HTML files and cram them together in the same file giving the file two HEAD sections? I see that Vakat said it works, but is it the best way to do it?

You must be logged in to reply to this topic.