Very well formated report in HTML format email to your email address:
Taken from some other site but successfully tested.
just change email address to your email address & ip address to ipaddress of your SMTP server.
$message = new-object System.Net.Mail.MailMessage(“email@email.com“, “email@email.com“)
$message.IsBodyHtml = $True
$message.Subject = “Automated E-Mail Quota Report”
$smtp = new-object Net.Mail.SmtpClient(“ipaddress“)
$mbcombCollection = @()
Get-Mailbox -ResultSize Unlimited | foreach-object{
$mbstatis = get-mailboxstatistics $_.identity
$TotalSizeMB = $mbstatis.TotalItemSize.Value.ToMB()
$mbcomb = “” | select DisplayName, TotalItemSizeMB, QuotaStatus, Itemcount, Email, CompanyName
$mbcomb.DisplayName = $_.DisplayName
$mbcomb.TotalItemSizeMB = $TotalSizeMB
$mbcomb.Itemcount = $mbstatis.ItemCount
$mbcomb.QuotaStatus = $mbstatis.StorageLimitStatus
$mbcomb.Email = $_.PrimarySmtpAddress
$mbcomb.CompanyName = $_.CustomAttribute1
$mbcombCollection += $mbcomb
}
$body = $mbcombCollection | Sort-Object -descending TotalItemSizeMB | where {$_.TotalItemSizeMB -ge 100} | convertto-html -head ‘<style type=”text/css”> body { background-color:#EEEEEE; } body,table,td,th { font-family:Tahoma; color:Black; Font-Size:10pt } th { font-weight:bold; background-color:#CCCCCC; } td { background-color:white; } </style>’
$message.Body = $body
$smtp.Send($message)