Solved

Outlook 2010 Daily inbound email

Posted on 2016-10-14
2
26 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
Comment Utility
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
Comment Utility
Thank you,.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
how to add IIS SMTP to handle application/Scanner relays into office 365.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now