1、导出csv文档
Export-Csv D:\ps\xxx.csv -Encoding UTF8 -NoTypeInformation
2、发送mail
$from="frommailaddress"$to="tomailaddress"$cc="ccmailaddress"$subject="主题"$smtpserver="sendmailsmtpserver"$message="Dears
内容,内容中可以带变量
"#发送邮件,可以带附件文档Send-mailmessage –bodyashtml –from $from –to $to -cc $cc –subject $subject –body $message –smtpserver $smtpserver -attachments D:\ps\userPermissioninfo_$CurrentDate.csv -Encoding ([System.Text.Encoding]::Utf8)
3、导入数据库
参考