Email A Text File's Content In Html Format
I have a text file as: output.txt: OPERATING SYSTEM SERVER1 SERVER2 Windows 1.36 4.42 Linux 2.78 5.76 MacOS
Solution 1:
HTML doesn't work the way you seem to expect. For one thing, the parser collapses all consecutive whitespace to a single space, so something like
OPERATING SYSTEM SERVER1 SERVER2
Windows 1.36 4.42
Linux 2.78 5.76
becomes
OPERATING SYSTEM SERVER1 SERVER2 Windows 1.36 4.42 Linux 2.78 5.76
when displayed.
If you want spaces/newlines preserved, change
BodyText = fso.OpenTextFile("c:\Output.txt",ForReading).ReadAll
BodyText = "<html><body>" + BodyText + "</body></html>"
objCDO1.HTMLBody = BodyText
into
BodyText = fso.OpenTextFile("c:\Output.txt",ForReading).ReadAll
objCDO1.HTMLBody = "<html><body><pre>" & BodyText & "</pre></body></html>"
or drop the HTML altogether and send the message as plain text.
Post a Comment for "Email A Text File's Content In Html Format"