HTML email sent as raw
use following command send html formatted (hopefully) message.
send-mailmessage -from $from -to $recipients ` -subject $subject -bodyishtml -body $body ` -smtpserver $smtpserver -port $smtpport ` -credential $credentials
but output email client is
<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>html table</title> </head><body style="border: 1px solid black; border-collapse: collapse;"> <h3>script name: backup_outlook_test.ps1</h3> <h3>start: 2016-08-25 15:01:25, end: 2016-08-25 15:01:25 duration: 0:00:00.0298102 </h3> <table style="border: 1px solid black; border-collapse: collapse;"> <colgroup><col/><col/></colgroup> <tr><th style="border: 1px solid black; background: #dddddd; padding: 5px;">timestamp</th><th style="border: 1px solid black; background: #dddddd; padding: 5px;">message</th></tr> <tr><td style="border: 1px solid black; padding: 5px;">8/25/2016 3:01:25 pm</td><td style="border: 1px solid black; padding: 5px;">test</td></tr> <tr><td style="border: 1px solid black; padding: 5px;">8/25/2016 3:01:25 pm</td><td style="border: 1px solid black; padding: 5px;">archiving complete</td></tr> <tr><td style="border: 1px solid black; padding: 5px;">8/25/2016 3:01:25 pm</td><td style="border: 1px solid black; padding: 5px;">archive created , moved d:\temp</td></tr> <tr><td style="border: 1px solid black; padding: 5px;">8/25/2016 3:01:25 pm</td><td style="border: 1px solid black; padding: 5px;">successful completion</td></tr> </table> </body></html>doing wrong?
so original post wrong , never have been used send message.
help send-mailmessage -full
look @ spelling of parameters.
we cannot of if post impossible code. didn't check because believed code used. can see never have worked.
in computers, science , technology must accurate. if have code doesn't work must post exact code , no arbitrary guess @ is. every character counts in programming.
learning how t work computer technology bit difficult. learning how work computer instructions can confusing non-engineers. take time read documentation , @ every part of every command. can solve of problems doing that.
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment