Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $discovery = get-mailbox -RecipientTypeDetails "sharedmailbox"
- $date = get-date -Format "MM-dd-yyyy"
- $path = "C:\temp\$date.csv"
- $mailfrom = "whatever@whatever.com"
- $mailto = "whatever@hatever.comm"
- $mailcc = "whatever@hwatever.com"
- $MailSubject = "$date Results"
- $MailBody = "Attached is the file with all the data that your hearts desire. Please do all the things."
- $MailSMTP = "mailserver.com"
- $MailSMTPPort = "25"
- if($discovery.count -ge 1){
- $discovery | export-csv -NoTypeInformation -Path $path
- Write-Host $count
- Send-MailMessage -from $mailfrom -to $mailto -cc $mailcc -Subject $MailSubject -Body $MailBody -SmtpServer $MailSMTP -Port $MailSMTPPort -Attachments $path
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement