Learn Exchange the Guru way !!!


Using Powershell to generate read receipts for emails

I recall using ASP.NET to enumerate a work flow to send emails and request a Read Receipt. Let’s look at how to achieve similar results using PowerShell.

The following PowerShell script will monitor all databases and report their Status if Mounted.

You can change “Mounted” to “Dismounted” in the Subject and cmdlet line to monitor “Dismounted’ databases

# Specify Sender, Recipient, Subject and Server
                  $From = ""
                   $To = ""
                   $Subject = "All Mounted Mailbox Databases"
                   $Server = "relayservername"
# Construct the Email
                   $Email = New-Object System.Net.Mail.MailMessage $From, $To
                   $Email.Subject = $Subject
                   $Email.IsBodyHTML = $True
# Request Read Receipt
                   $Email.Headers.Add(“Disposition-Notification-To”, “”)
# Add the script or input cmdlet
                   $Email.Body = Get-MailboxDatabaseCopyStatus * | where {$_.Status -Like "Mounted"} | Select-Object Name,Status | ConvertTo-Html
# Send the Email
                   $Compose = New-Object Net.Mail.SmtpClient($Server)                  

Ratish Nair

Microsoft MVP | Exchange Server


Leave a Reply




Do NOT follow this link or you will be banned from the site!