Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Be notified by Mail only for a specific mailbox System 10.8
Mail notifications, while useful, can be overwhelming. That's why Mail can restrict the notifications (Dock badge and Notification Center) to a specific mailbox or Smart Mailbox.

Notifications restriction is available from Mail's Preferences; however here is a way to change this setting using a script, without going through the GUI.

This is especially useful when used with location-aware apps, such as Marco Polo or ControlPlane: you can automatically be notified of your professional e-mails only when at work, and of your personal emails only when at home, for instance.

I find it especially useful to keep focused and reduce the amount of distracting notifications.

#!/bin/bash
#
# Configure Mail.app to enable notifications only in the specified mailbox.
# Notifications include the Dock badge and messages in the Notification Center.
#
# Usage:
#   restrict-mail-notifications 
#
# Example:
#   restrict-mail-notifications smartmailbox://f687826d-f4de-4724-9a12-c5794dcdaa32
#
# Notes:
#   To find the mailbox id you're interested in, look in the com.apple.mail.plist file.
#

mailboxID="$1"

if [ ! -n "$mailboxID" ]; then
	echo "Error: "mailboxID" parameter missing."
	echo "Usage: $0 "
	exit -1
fi

# Only display the unread messages count in the Dock for the specified mailbox
defaults write com.apple.mail MailDockBadgeMailbox "$mailboxID"

# Only display notifications for incoming messages in the specified mailbox
defaults write com.apple.mail MailUserNotificationScope -int '4' # Smart mailboxes
defaults write com.apple.mail MailUserNotificationMailbox "$mailboxID"

# Now relaunch Mail.app for changes to take effect
[kirkmc adds: I haven't tested this.]
    •    
  • Currently 3.00 / 5
  You rated: 1 / 5 (4 votes cast)
 
[3,283 views]  

Be notified by Mail only for a specific mailbox | 2 comments | Create New Account
Click here to return to the 'Be notified by Mail only for a specific mailbox' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Be notified by Mail only for a specific mailbox
Authored by: dhaskew on Aug 08, '12 07:50:05AM

I haven't tried this yet, but killer hint. Thanks.

I'll be using this with ControlPlane shortly! Love that app!



[ Reply to This | # ]
Be notified by Mail only for a specific mailbox
Authored by: PeterAlexabder on Aug 08, '12 08:49:30AM

How do you create, save and attach the script to a context in ControlPlane?



[ Reply to This | # ]