1、导出csv文档
Export-Csv D:psxxx.csv -Encoding UTF8 -NoTypeInformation
2、发送mail
$from="frommailaddress" $to="tomailaddress" $cc="ccmailaddress" $subject="主题" $smtpserver="sendmailsmtpserver" $message="<style type='text/css'> <!-- .style1 {font-size: 16px; color: #000099; font-family: '新細明體'; } --> </style> <p class='style1'>Dears</p> <p class='style1'>内容,内容中可以带变量</p> </p> " #发送邮件,可以带附件文档 Send-mailmessage –bodyashtml –from $from –to $to -cc $cc –subject $subject –body $message –smtpserver $smtpserver -attachments D:psuserPermissioninfo_$CurrentDate.csv -Encoding ([System.Text.Encoding]::Utf8)
3、导入数据库