Solved

Outlook 2010 Daily inbound email

Posted on 2016-10-14
2
41 Views
Last Modified: 2016-10-17
Is there a way to know the number of inbound email over one mailbox?
0
Comment
Question by:Hiroyuki Tamura
2 Comments
 
LVL 15

Accepted Solution

by:
cwstad2 earned 500 total points
ID: 41843770
Hi are you using exchange 201*

If so you can try the following script, but you will need to modify so that its for one day

####################################
# Exchange 2010 send/receive weekly report generator
# Created by: Eric Schewe
# Created on: 2014-10-02
#
####################################
# Summary:
#   This script will count the unique message IDs send and recieved by a mailbox
#   on a weekly basis and e-mail a report to the designated recipients. We are
#   specifically using this script to track mailflow to and from a generic account
#   in our enviroment.
#
#   This script is meant to be run on a Monday so it can gather the previous weeks
#   e-mails (Monday - Sunday).
#
####################################
# Instructions:
#   1. Set $mailbox to the generic account you want stats from
#   2. Set $emailFrom to the e-mail address that the report will be sent from
#   3. Set $emailTo to the people who will receive the report
#   4. Set $smtpServer to a SMTP server you can send e-mail from
#   
####################################
 
#Powershell Garbage
$nl = [Environment]::NewLine
 
#Mailbox to gather stats on
$mailbox=""
 
#Get todays date twice
$startDate=Get-Date
$endDate=Get-Date
 
#Subtract 1 day from todays date (report ending day) and 7 days from todays date (report starting day)
$startDateFormatted=$startDate.AddDays(-7).ToShortDateString()
$endDateFormatted=$endDate.AddDays(-1).ToShortDateString()
 
 
#Who to send the e-mail report to.
#Multiple e-mail addresses should be in this format "<email1@somewhere.com>, <email2@somewhere.com>"
$emailFrom = "no-reply@mydomain.com"
$emailTo = ""
$subject = "Weekly e-mail report for $mailbox for $startDateFormatted - $endDateFormatted"
$smtpServer = ""
 
 
# Sent e-mails
$sendCount = Get-TransportServer | Get-MessageTrackingLog -Start "$startDateFormatted 00:00:00" -End "$endDateFormatted 23:59:59" -Sender $mailbox -resultsize unlimited | select-object -unique MessageId
 
# Received e-mails - This works but not on generic accounts
$receiveCount = Get-TransportServer | Get-MessageTrackingLog -Start "$startDateFormatted 00:00:00" -End "$endDateFormatted 23:59:59" -Recipients $mailbox -resultsize unlimited | select-object -unique MessageId
 
$sendCountString = $sendCount.count
$receiveCountString = $receiveCount.count
 
$body = "Mailbox stats for: $mailbox $nl
Report date range: $startDateFormatted 00:00:00 - $endDateFormatted 23:59:59 $nl
Total e-mails sent: $sendCountString $nl
Total e-mails received: $receiveCountString"
 
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($emailFrom, $emailTo, $subject, $body)

I have a scheduled task configured on one of our Exchange servers that runs this every Monday morning and provide me the stats on a generic mailbox for the previous week (Monday – Sunday).

Open in new window

0
 

Author Closing Comment

by:Hiroyuki Tamura
ID: 41847041
Thank you,.
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question