Author Posts

May 6, 2016 at 12:04 am

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


May 6, 2016 at 4:34 am

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

May 6, 2016 at 6:12 am

$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

May 6, 2016 at 6:13 am

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

May 11, 2016 at 2:55 am

Thanks. Worked fine.


May 11, 2016 at 3:46 am

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?