我显然不知道自己在做什么,但最终我尝试使用$imported | Export-Csv -Path "C:\CSVoutput.csv" -Force -NoTypeInformation
$getallzero = gc "C:\csvoutput.csv"
$getallzero = $getallzero -replace '"', ""
$zeropath = "C:\zero.txt"
Add-Content $zeropath $getallzero
从.CSV文件传递报告。我只拉出“新”中的0行。专栏,所以我可以调查那些。
$recipients = "<myself@server.com>","<otherguy@server.com>"
$body = Get-Content -Path $zeropath -Raw
Send-MailMessage -SmtpServer mail.server.com -To $recipients -From zeroreport@server.com -Subject "zero report issues" -Body ($body|Out-String)
现在我将其退出,因为它是我如何得到它最接近所需结果,并删除引号。
zero.txt
这在zero.txt中看起来很好,数据在文本文件中可由CrLfs读取和分离,因此我试图将其放入电子邮件正文中。
{{1}}
电子邮件中的输出如下所示:
DATE,TIME,DIR,LOC,EMP,TYPE,NEW,OLD,TOTAL,FILE,DIRE,FILE SIZE,FILE UPDATE DATE,PROGRAM 12/30/2015,730,QMC,QCC,ER,TRAN,0,0,0,QMCEK2.TXT ,QMC,6407,12/30/2015,QMCEKT3 12/30/2015,821,JCB,JCP,ER,TRAN,0,0,22,ODCRPT3 ,PGM,876466,12/30/2015,JCBTP2 12/30/2015,200,KRC,AMS,ER,DEM2,0,0,379,VZCHL7.TXT ,PGM,314259
电子邮件应该看的文本文件/方式是:
DATE,TIME,DIR,LOC,EMP,TYPE,NEW,OLD,TOTAL,FILE,DIRE,FILE SIZE,FILE UPDATE DATE,PROGRAM 12/30/2015,730,QMC,QCC,ER,TRAN,0,0,0,QMCEK2.TXT ,QMC,6407,12/30/2015,QMCEKT3 12/30/2015,821,JCB,JCP,ER,TRAN,0,0,22,ODCRPT3 ,PGM,876466,12/30/2015,JCBTP2 12/30/2015,200,KRC,AMS,ER,DEM2,0,0,379,VZCHL7.TXT ,PGM,314259,12/30/2015,VZCTB2
如果在不使用HTML的情况下这是不可能的,那么我只会附加{{1}},我可以将其关闭。