Measuring Work – Email Sent and Received

I’m often curious about where my time goes during the work day. When I’m not working on a project or doing some specific tasks, a lot of my time seems to be spent reading or responding to email. The most hectic days for me often seem to be early in the week—Mondays or Tuesdays. I decided to measure how much email that I send and receive each day of the week to see if it correlated to my perceived levels of busyness. I wasn’t really sure if there would be anything actionable from measuring work in this way, but figured it would be an interested thing to have perspective on.

To begin measuring the amount of email that I sent and received, I wrote two scripts to query my IMAP email account. I’ve reproduced them below. I have them set up with a wrapper in my PATH so that I can run them from the command line to get a quick sense of how much time I’m probably spending on email on a given day compared to others. The scripts are configured to count the email for up to two weeks (and ending the week on a Sunday).

email.rb


require 'net/imap'
require 'yaml'

folders = {
  sent: '[Gmail]/Sent Mail',
  received: '[Gmail]/All Mail'
}

folder = ARGV[0] || 'sent'

root = File.expand_path(File.dirname(__FILE__))
credentials = YAML.load_file(File.join(root, '.email_creds'))
imap = Net::IMAP.new('imap.gmail.com', port: 993, ssl: true)
imap.login(credentials[:username], credentials[:password])
imap.select(folders[folder.to_sym])

today = Time.new
one_day = 86_400
starting_day = today + one_day
days = 14
count_days = 0
count_sundays = 0
tally = 0

days.times.each do |day|
  break if count_sundays >= 2
  beginning = starting_day - (day * one_day)
  ending = starting_day - ((day * one_day) + one_day)
  count_sundays += 1 if ending.sunday?
  number_sent = imap.search(['BEFORE', beginning.strftime('%d-%B-%Y'), 'SINCE', ending.strftime('%d-%B-%Y')]).size
  puts ending.strftime('%a %d-%B-%Y') + ' : ' + number_sent.to_s
  tally += number_sent
  count_days += 1
end

puts "Total: #{tally}"
puts "Avg. per day: #{(tally * 1.00) / count_days}"

I put this bash script in my PATH so that I can simplify the invocation from the command line and not need to explicitly call Ruby.

email


#!/bin/bash
ARGS="$@"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

ruby_exec=`which ruby`

if [ ! -x "$ruby_exec" ]
then
  echo "Could not find ruby in your path"
  exit 1
fi

$ruby_exec "${BASH_SOURCE[0]}".rb $ARGS

This allows me to quickly see how this week is going compared to last:


jk@gerty ~  $ email received
Mon 15-June-2015 : 135
Sun 14-June-2015 : 40
Sat 13-June-2015 : 52
Fri 12-June-2015 : 61
Thu 11-June-2015 : 86
Wed 10-June-2015 : 101
Tue 09-June-2015 : 105
Mon 08-June-2015 : 121
Sun 07-June-2015 : 51
Total: 752
Avg. per day: 83.55555555555556

With a little adaptation, I was able to output the results in CSV so that I could easily graph the amount of email I handle each day of the week.

email_received

email_sent

From the graphs, it’s clear the that busiest day for both sending and receiving email is often the first day of the week (usually Monday). This isn’t particularly surprising, given that the first day of the week usually involves catching up on weekend email and events. However, the data validates that it’s not just my feeling that Mondays are so hectic—I’m actually spending a lot more time reading and writing email. For me, writing email is generally not a quick process. Most replies require a well-formed response that requires time and thought.

Given this data, I may more consciously try to plan scheduled activities for later in the week. As the early week is often spent being reactive and responding to email, time for schedule work is limited. Later in the week, there is more slack time, and I can be more proactive without risking as much interruption.

Conversation
  • Ryan says:

    Very neat Justin. I feel like you would like the software called Time To Reply. It does all the work for you and works with all the major email servers. I am in customer service and use the software to see how fast my agents are replying to mail. There are weekly reports that I find super useful. Check it out man it sounds like something you would like!

    Ryan

  • John says:

    Very helpful! I was wondering, is it easily possible to extend the script to find out average response times of your replies?

  • Comments are closed.